B&K user manual BK Precision 4071 User Manual Rev.2.2

Models: 4071

1 88
Download 88 pages 40.73 Kb
Page 80
Image 80

'------------------------------------------------------------------------------

'------------------------------------------------------------------------------

'

SUBROUTINES

'------------------------------------------------------------------------------

'------------------------------------------------------------------------------

' These subroutines are also used by other example programs.

'------------------------------------------------------------------------------

'

Get ASCII response from 4071

'Wait for an incoming char, then collect incoming stuff until we get a

'800 mS Rx char time-out

'Returns with a$ = received stuff

'------------------------------------------------------------------------------

GetResponse1:

IF

LOC(1) = 0 THEN GOTO GetResponse1

' Wait for incoming char

a$ = ""

 

 

GetRespLoop1:

 

 

a$ = 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.

CALL Delay(.8)

' Do a 800 mS delay

IF LOC(1) <> 0 THEN GOTO GetRespLoop1

' If something came in during

RETURN

 

' our time-out, grab it

 

 

'------------------------------------------------------------------------------

 

 

'

Wait for a command prompt from 4071

' Returns A$ = all stuff received before the command prompt.

'------------------------------------------------------------------------------

PromptWait:

' If we have no chars in Rx buffer, wait until we have 1 or more

a$ = ""

PromptWaitLoop:

IF LOC(1) = 0 THEN GOTO PromptWaitLoop

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

IF INSTR(a$, ">") THEN GOTO GotPrompt

GOTO PromptWaitLoop

'Here we got a prompt. Exit GotPrompt:

RETURN

75

BK Precision 4071 User Manual Rev.2.2

Page 80
Image 80
B&K user manual BK Precision 4071 User Manual Rev.2.2