HP Instrument BASIC 101

This is not a tutorial. HP has an excellent User Guide and User Handbook. This is just an example to get you started. We will do the following:

  • Record a measurement
  • Save the recorded program to a floppy disk
  • Edit the program in a PC so that it can run
  • Load and run the program in the 35665A
Keeping with the tradition of HP manuals this is a [Hardkey], this is a [SOFTKEY] (the buttons at the right of the screen) and this is a [SOFTKEY WITH AN OPTION] selected.

Recording a measurement

We will do a source characterization (the first task of the Quick Start Guide). To do this you need to connect a BNC male-to-male cable from SOURCE to CHANNEL 1 first. Also now is a good time to insert a floppy disk in the drive.

Here we go:

[Preset] [DO PRESET]
[BASIC] [INSTRUMNT BASIC] [SELECT PROGRAM] [PROGRAM 1] [RETURN]
[ENABLE RECORDING] this starts the recording
[Preset] [DO PRESET]
[Source] [SOURCE ON OFF]
[FIXED SINE] [2] [0] [.] [5] [kHz]
[LEVEL] [0] [dbVrms]
[Avg]  [AVERAGE ON OFF]
[NUMBER AVERAGES] [3] [0] [ENTER]
[Start]
[Marker] [MARKER TO PEAK] [REFERENCE TO MARKER]
[Marker Fctn] [HARMONIC MARKER] [FUNDAMNTL FREQUENCY]
[Marker Value] [THD]
[Plot/Print] [OUTPUT FILENAME] type "THDP0001" [ENTER]
[MORE SETUP] [OUTPUT TO HPIB FILE] [DEVICE IS PLOT PRNT]
[RETURN]
[START PLOT/PRNT]
[BASIC] this stops the recording and brinks up the HP Instrument BASIC menu.
[Save/Recall] [SAVE MORE] [SAVE PROGRAM] type HPBASIC.B [ENTER]
Now the program is saved and you can move the floppy disk to the PC.

Open the program with a text editor. With any luck the program you saved looks like this:

And THDP0001 looks like this:

You can read here how to open a plot from the floppy drive.

If you try to run the program you recorded as is you will get something like this:

THDP0001 rerun
To run the stored program do the following:
[Save/Recall] [RECALL MORE] [RECALL PROGRAM] type HPBASIC.B [ENTER]
[BASIC] [HPBASIC.B]

The problem is that Instrument BASIC is feeding the commands to the Analyzer too fast. Now lets edit the program and add some delays. The 5 seconds are arbitrary (just to make the thing run). I am not trying to optimize how long the measurements takes.

The print should now look like this:

THDP0002