BNC 630 User Manual

Page 87

Advertising
background image

82

'------------------------------------------------------------------------------
' Flush all Rx chars from Port 1 buffer
'------------------------------------------------------------------------------
FlushBuff1:

IF LOC(1) = 0 THEN GOTO DoTimeout1

a$ = INPUT$(LOC(1), #1) ' Get all waiting chars in Rx buffer

' Now wait for a time-out time to make sure no new stuff is coming in.
DoTimeout1:
CALL Delay(.8) ' Do a 800 mS delay

IF LOC(1) <> 0 THEN GOTO FlushBuff1 ' If something came in during
' our time-out, flush it
RETURN

'------------------------------------------------------------------------------
' Wait for x mS
' Function to delay x number of mS.
'------------------------------------------------------------------------------
SUB Delay (X%) STATIC

start! = TIMER ' Returns no. of secs since midnight.
' Example: 65445.15

DelayLoop: ' Do a x mS delay
IF TIMER < start! + X% / 1000 THEN GOTO DelayLoop

END SUB

'------------------------------------------------------------------------------
' Wait for a keypress
'------------------------------------------------------------------------------
SUB Pause STATIC

DO
LOOP UNTIL INKEY$ <> "" ' Wait for keypress to continue

END SUB

Advertising