B&K 4070A Portable Generator User Manual


 
BK Precision 4070A User Manual Rev.2.2
75
'------------------------------------------------------------------------------
'------------------------------------------------------------------------------
' SUBROUTINES
'------------------------------------------------------------------------------
'------------------------------------------------------------------------------
' These subroutines are also used by other example programs.
'------------------------------------------------------------------------------
' Get ASCII response from 4070A
' 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
' our time-out, grab it
RETURN
'------------------------------------------------------------------------------
' Wait for a command prompt from 4070A
' 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