Fem-03 flow monitor – AW Gear Meters FEM-03 User Manual

Page 41

Advertising
background image

FEM-03 Flow Monitor

Operation and Programming Manual

40


DEFINT A-Z

'* Serial Communication Test Program for OPTOMUX Code
'* For use with AW Company's FEM-03 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 Checksum

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

Advertising