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 them 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:
Switch the 4070A to Burst mode |
'Send the following command string to the 4070A:
'A M6 F2 xxX F1 xxX F3 xxX F0
'These characters have the following meaning:
'A - Reset the 4070A to Sinewave mode (ensures the state of 4070A)
'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 4070A will now trigger a single burst for each "t" char we sent it. After the
' 4070A 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 4070A has finished
'processing the last "t". The GetResponse1 subroutine has a
'accomplish this purpose.
GOSUB GetResponse1 | ' Wait for and get response from 4070A to a$ |
79
BK Precision 4070A User Manual Rev.2.2