Serial Communications
|
A-13
Sample Program
This section provides a sample Quick Basic program that reads and writes to the
serial port
DECLARE FUNCTION Checksum$ (M$)
‘Serial test routine’ Continuously sends a message and prints the string returned
CLS
‘Open the communications port
OPEN “COM2: 9600,N,8,1 “ FOR RANDOM AS #1
‘String to be echoed
T$ = “Test Message”
‘Address of the series 2000 controller
Address% = 254
‘Build the message
M$ = “>>” + HEX$(Address%) + “A” + T$
M$ = M$ + Checksum$(M$)
‘Continue sending message until key pressed
‘ (Assumes that Series 2000 controller is connected)
WHILE (INKEY$ = “”)
PRINT #1, M$
LINE INPUT #1, A$
‘Show results
PRINT “Sent......”; M$
PRINT “Returned...”; A$
WEND
CLOSE #1
STOP
FUNCTION Checksum$ (M$)
DIM Sum AS LONG
Sum = 0
‘Skip FOR i% = 2 TO LEN(M$)
Sum = Sum + ASC(MID$(M$, i%, 1))
NEXT i%
‘Get low byte of checksum
Checksum$ = HEX$(Sum MOD 256)
END FUNCTION<P255D>
Содержание CEM/Humox
Страница 20: ...2 4 Thermox CEM Humox Analyzer This page intentionally left blank ...
Страница 38: ...3 18 Thermox CEM Humox Analyzer Figure 3 16 Series 2000 alarm connections example ...
Страница 40: ...3 20 Thermox CEM Humox Analyzer Figure 3 17 Series 2000 2 wire RS 485 communication connection ...
Страница 42: ...3 22 Thermox CEM Humox Analyzer Figure 3 18 Series 2000 4 wire RS 485 communication connections ...
Страница 44: ...3 24 Thermox CEM Humox Analyzer ...
Страница 76: ...4 32 Thermox CEM Humox Analyzer This page intentionally left blank ...
Страница 105: ...Service and Parts 7 3 THIS PAGE INTENTIONALLY LEFT BLANK ...
Страница 107: ...Service and Parts 7 5 Figure 7 1 Cell replacement ...
Страница 130: ...B 4 Thermox CEM Humox Analyzer This page intentionally left blank ...
Страница 134: ...C 4 Thermox CEM Humox Analyzer Figure C 1 Modulation of external power supply OPTIONAL ...
Страница 136: ...D 2 Thermox CEM Humox Analyzer This page intentionally left blank ...