Automating Measurements 3-19
Operator Interaction
Using a Foot or Hand Switch
Using a Foot or Hand Switch
You can connect a foot switch, button box, or custom keyboard which has
a few function keys that are custom-labeled, and use this in conjunction
with IBASIC to allow consistent, error-free step-by-step measurement
control. The operator presses one key, then the next, in order.
NOTE A switch can also be used with the analyzer’s fast-recall feature. See
“Using Fast Recall with a Switch” on page 4-5.
The foot-switch simply connects two wires together, grounding the center
pin of the analyzer's USER TTL IN/OUT rear panel connector. (See
Figure 3-2.) The status of the USER TTL IN/OUT can be read using the
SCPI commands:
30 OUTPUT 716;"DIAG:PORT:READ? 15,1"
40 ENTER 716;X
or the IBASIC command:
30 X=READIO(15,1)
When the foot-switch is open, the variable “X” will be set to 1. When it is
closed, the variable “X” will be set to 0. Switch debounce is generally not
a problem, due to the relatively slow polling rate of the program.
Refer to “Analyzer Port Numbers” on page 3-22 for tables describing the
various analyzer ports that you can access using SCPI or IBASIC
commands.
Following is an example program which shows how to display a message
and read the foot switch to control your measurements. This program is
named “TTL_IO” on your Example Programs Disk.
For an example which uses the IBASIC READIO command, refer to the
program “USER_BIT” on your Example Programs Disk.
100 ! Filename: TTL_IO
110 !
120 ! This program reads the USER TTL IO
130 ! port, and counts how many times a
140 ! switch connected to the port is pressed.
150 !
160 DIM Msg$[200]
170 INTEGER X
180 !
190 IF POS(SYSTEM$("SYSTEM ID"),"HP 871") THEN
200 ASSIGN @Hp8711 TO 800