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

Models: 4071

1 88
Download 88 pages 40.73 Kb
Page 84
Image 84

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

Make sure a 4071 is attached to the serial port --------------

'If we send the 4071 a control E character, it will respond with a control C. We use

'this feature to see if a 4071 is attached. If a 4071 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 4071, 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 4071

PRINT "Connect the 4071 to the serial port and power the 4071"

ConnectLoop:

PRINT #1, CHR$(5); ' Print a control E to 4071 (ASCII char 5)

'Wait for the 4071 to give us some characters. When they arrive, put them into the

'string a$

GOSUB GetResponse1

' Wait for and get response from 4071 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 4071? IF INSTR(a$, CHR$(3)) THEN GOTO GotSg100

GOTO ConnectLoop

GotSg100:

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

Switch the 4071 to Burst mode --------------

'Send the following command string to the 4071:

'A M6 F2 xxX F1 xxX F3 xxX F0

'These characters have the following meaning:

'A - Reset the 4071 to Sinewave mode (ensures the state of 4071)

'M6 - Go to Burst Mode

'F3 - Move cursor to field 3 (the burst frequency field)

'

xxX

- Enter a frequency of xx Hz (infrared carrier freq)

'

F2

- Move cursor to field 2 (the burst duration field)

' xxX

- Enter a duration of xx mS (burst on time)

'

F4

- Move cursor to field 4 (the burst delay field)

' xxX

- Enter a duration of xx mS (burst off time)

'

F0

- Move cursor to field 0 (turns cursor off)

 

PRINT #1, "A M6 F3";

 

 

PRINT #1, CarrierFreq$; "X";

' Send measured carrier freq

 

PRINT #1, "F2 ";

 

 

PRINT #1, OnTime$; "X";

' Send burst on time

 

PRINT #1, "F4 ";

 

 

PRINT #1, OffTime$; "X";

' Send burst off time

 

PRINT #1, "F0";

 

'The 4071 will now trigger a single burst for each "t" char we sent it. After the

'4071 executes each "t" command, it will return a prompt character (">"). We wish to

'wait until after all prompts have come in, since that's when the 4071 has finished

'processing the last "t". The GetResponse1 subroutine has a time-out feature which will

'accomplish this purpose.

GOSUB GetResponse1

' Wait for and get response from 4071 to a$

79

BK Precision 4071 User Manual Rev.2.2

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