AW Gear Meters EMO-500 User Manual
Page 37

EMO-500
Operation and Programming Manual
36
DEFINT A-Z
'* Serial Communication Test Program for OPTOMUX Code
'* For use with AW Company's EMO-Series Flow Computers
'* Open serial port #1 to 9600 baud
OPEN "COM1:9600,N,8,1,RS,CS,DS,CD" FOR RANDOM AS #1
'* set up loop for transmitting several strings
CLS
DO
PRINT "Enter String to send. (Press ENTER alone to END)"
INPUT "Transmitting String: >", Transm$
IF LEN(Transm$) = 0 THEN END
'* Calculate Chksum
Chk = 0
FOR Char = 1 TO LEN(Transm$)
Chk = Chk + ASC(MID$(Transm$, Char, 1))
NEXT
Chk$ = HEX$(Chk)
'* Must be 2 characters, 1 byte
IF LEN(Chk$) < 2 THEN Chk$ = "0" + Chk$
'* Add the recognition character plus checksum
'* use only the last byte of checksum
Transm$ = ">" + Transm$ + RIGHT$(Chk$, 2)
'* Send it to the EMO
PRINT #1, ; Transm$; CHR$(13);
'* Read what the EMO sending back
LINE INPUT #1, Receive$
PRINT "Received: "; Receive$
PRINT
LOOP
The communications port does not discriminate any addresses. This means that any address can be
written to as well as read from. Writing to certain addresses changes the operation of the EMO-500
drastically. Caution is a must! Double check addresses and variables before writing to the EMO-500.
Warning!