Appendix A
Example remote control host program
This chapter contains an example program written in Microsoft QuickBasic for remotely controlling the 4071. It can be used as a starting point for writing your own remote control applications.
The program illustrates several basic techniques for remotely controlling the 4071 with a control program. The program begins by showing how to detect the presence of the 4071 on the serial port. It also shows how to set the operating mode and enter parameters such as frequency and level. The program also parses information sent from the 4071 to the host computer and displays that information on the screen.
Hardware Setup
You must connect a serial cable between your computer and the
The program assumes you are using serial port 1 (COM1). If you are using another serial port, change the OPEN COM1... statement in the beginning of this program. It also assumes that the 4071 baud rate is set to 9600. To check the 4071 baud rate, press the Mode then offset keys.
This example program switches the 4071 to DTMF Detection mode and displays the detected DTMF digits to the screen. To detect DTMF digits, the DTMF signal must be applied to the Ext Mod Input jack on the rear of the unit. A schematic diagram, which takes these tones from a telephone line, is shown below:
To
Telephone
Line
.001475K
200V | 1% |
|
Telco Tip
Telco Ring 475K
1%
.001
200V
115K
1%
115K
1%
| 4 | |
2 | LM741 | |
6 | ||
3 | ||
7 | ||
| ||
| +12V |
To
Ext Mod In
Connector
Figure A-1: Telephone line amplifier
*** Caution ***
Do NOT connect the Ext. Mod In input directly to a telephone line. High voltages exist on a telephone line, which
will cause permanent damage to the 4071.
This program does the following:
1.Clear the screen
2.Open the serial communications port for communicating with the 4071.
3.Make sure there is a 4071 connected to the serial port. If we can't find one, wait until it is connected up.
4.Command the 4071 to generate 18.432 MHz at 0.0 dBm.
5.Wait for the user to press a key.
6.Switch the 4071 to DTMF Detection mode.
7.Wait for the 4071 to detect a DTMF digit and print it to the terminal.
72
BK Precision 4071 User Manual Rev.2.2