Fluid Components International GF90_GF92 User Manual

Page 50

Advertising
background image

FLUID COMPONENTS INTERNATIONAL LLC

http://www.fluidcomponents.com

GF Series Flow Meter Models GF90/GF92

46

Doc. No. 06EN003229 Rev. H

' Serial Communication example
' Fluid Components Intl

' This program places the flowmeter into normal
' operation and displays the current flow rate and
' temperature.

DEFINT A-Z

ON ERROR GOTO error.trap

COLOR 7, 1

' Set screen color.

CLS

Quit$ = CHR$(0) + CHRS$(16)

' Value returned by INKEY$
' when ALT+q is pressed.

' Set up screen and turn cursor off.

LOCATE 24, 1, 0
PRINT STRING$(80, "_");
LOCATE 25, 1
PRINT TAB(30); "Press ALT+q to quit";

VIEW PRINT 1 TO 23

' Print between lines 1 & 23.

' Open communications (9600 baud, no parity, 8-bit data,
' 1 stop bit, 256-byte input buffer):

OPEN "COM1:9600,N,8,1,RS,CS,DS,CD,OP10000,RB2000" FOR RANDOM AS #1 LEN =512

PRINT#1, "H";

' Send a HOME command. (Send
' another also.)

x! = TIMER

' Wait for response. (A long

DO UNTIL TIMER - x! 3

' wait is not necessary after

LOOP

' most commands.)

PRINT #1, "H";

' Send another HOME command

x! = TIMER

' Wait again

DO UNTIL TIMER - x! 3

LOOP

PRINT #1, "1";

' Normal Operation

DO

' Main communications loop.

KeyInput$ = INKEY$

' Check the keyboard.

IF KeyInput$ = Quit$ THEN

' Exit the loop if the user

EXIT DO

' PRESSED alt+q.

END IF

GFINPUT$ = ""

' Empty the two working

moreGFInput$ = ""

'strings

Figure 31A - Series Serial Communication Code Example

Advertising