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

Models: 4071

1 88
Download 88 pages 40.73 Kb
Page 79
Image 79

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

Set a frequency and level on the 4071 --------------

'Send the following command string to the 4071:

'A F1 18.432Z F2 0.0Z F0

'These characters have the following meaning:

'A - Reset the 4071 to Sinewave mode

'F1 - Move cursor to field 1 (the frequency field)

'18.432Z - Enter a frequency of 18.432 MHz

'F2 - Move cursor to field 2 (the level field)

'0.0Z - Enter a level of 0.0 dBm

'F0 - Move cursor to field 0 (turns cursor off)

PRINT #1, "A F1 18.432Z F2 0.0Z F0";

'After the 4071 executes each 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 executing the last command. The

'GetResponse1 subroutine has a time-out feature which will accomplish this purpose.

GOSUB GetResponse1

' Wait for and get response from 4071 to a$

'Let the user know what's going on

CLS

PRINT "CW mode selected. Frequency and Level have been set."

PRINT : PRINT

PRINT "Press any key to go to DTMF Detection mode"

'Wait for the user to press a key before we switch to a new mode. CALL Pause

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

Switch to DTMF Detection mode --------------

' This example illustrates how to parse information from the 4071

 

PRINT #1, "M9";

' Command the 4071 to go to DTMF Detection mode

 

GOSUB PromptWait

' Wait for 4071 to finish this command

 

GOSUB FlushBuff1

' Flush all received chars from 4071

'Let the user know what's going on

CLS

PRINT : PRINT

PRINT "Now in DTMF Detection mode. All DTMF detections will be printed."

PRINT

'When the 4071 detects a DTMF digit, it will print the following text

'to the terminal port: CR,LF,"DTMF: 7"

DTMFLoop:

 

GOSUB GetResponse1

' Wait for and get response from 4071 to a$

'The 4071 prints a semicolon (:) character whenever it is reporting data.

'The data follows immediately after the semicolon.

IF INSTR(a$, ":") THEN

a = INSTR(a$, ":") + 1 ' Get the data that follows the ":" character

a$ = MID$(a$, a, 2) ' (Strip off everything else) PRINT "Detected DTMF digit is: "; a$

END IF

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

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

GOTO DTMFLoop

' Otherwise keep looking for more DTMF detections

74

BK Precision 4071 User Manual Rev.2.2

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