B&K 4070A user manual Cls

Models: 4070A

1 88
Download 88 pages 28.04 Kb
Page 78
Image 78

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

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

'

Program Start

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

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

DECLARE SUB Delay (X%)

' Declare functions used below.

 

' (The Delay function waits x mS then returns)

DECLARE SUB Pause ()

' (The Pause fctn waits for a keypress then returns)

CLS

' Clear the screen

'Open serial port 1 for communication with the 4070A with these parameters:

'Ignore the CD,CTS,DCD flow control lines

'Set a 5 sec maximum time-out for basic to open the port

'Set the receive buffer to 2K bytes

'Disable the RTS flow control line

'Set the transmit buffer to 1K bytes

'File access type is Random

'Set random access buffer size to 2K

OPEN "COM1:9600,n,8,1,CD0,CS0,DS0,OP5000,RB2048,RS,TB1024" FOR RANDOM AS #1 LEN = 2048

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

Make sure a 4070A is attached to the serial port --------------

' If we send the 4070A a control E character, it will respond with a control C. ' We use this feature to see if a 4070A is attached.

' If a 4070A cannot be found, wait until one is attached.

' User can abort the program at this point by pressing any key.

' When power is applied to the 4070A, it prints a menu to the serial port. We wish to ' disregard these characters, so flush them.

GOSUB FlushBuff1

' Flush all received chars from buffer

' Tell the user to connect up a 4070A

PRINT "Connect the 4070A to the serial port and power the 4070A"

ConnectLoop:

 

PRINT #1, CHR$(5);

' Print a control E to 4070A (ASCII char 5)

'Wait for the 4070A to give us some characters. When they arrive, put

'then into the string a$

GOSUB GetResponse1

' Wait for and get response from 4070A to a$

' Allow the user to exit the program by pressing a key.

IF INKEY$ <> "" THEN SYSTEM ' Exit on first terminal keypress

'Did we get a control C (ASCII char 3) from the 4070A? IF INSTR(a$, CHR$(3)) THEN GOTO GotSG100

GOTO ConnectLoop

GotSG100:

73

BK Precision 4070A User Manual Rev.2.2

Page 78
Image 78
B&K 4070A user manual Cls