Appendix B - Data Formats ................................................................... B-l
...............................
I
_.
.,
..
.............................
._._.
................
_
.......................
._.~.
., _ .,
Appendix C - Status Words and SRQ Format I .................................. .I .............. C-l
Appendix D - Front Panel Modes and Equivalents IEEE-488 Commands ........................... D-l
Appendix E - Data~ Transmission and NRFD Hold-off Times ...... ; .............................. E-l
ABOUT THIS PROGRAMMING GUIDE
This programming guide is intended as a tt.&xial on a number of programming conceptss
associated with the Model 194A. It is not intended to replace the IEEE-488 programming
section of the Instruction Manual, which should be consulted for detailed programming
information.
Programming concepts discussed in this guide include:
l Programming a single-channel unit and obtaining data.
l Programming a dual-channel unit and requesting data.
l Single/continuous arming and~triggering.
l Using binary data transfer to optimize speed.
l Using SRQ and error word to minimize controller overhead.
l Buffer operation, including use of buffer pointers.
l Using Translator to increase readability and emulate-other instrumentation.
In addition to these fundamental concepts, applications programs for external sample tiggering, plotting data, and trigger performance and timing are also included. Fmally, reference
information such as device-dependent commands, data formats, and error words is also
supplied.
l/2
COMPUTER PROGRAMMING
SYNTAX
All the example programs in this guide are written in Hewlett=Packard BASIC 4.0, which
is used on the Series 200 and 300 computers. This programming language was chosen for
these examples because of its ease of understanding, as well as its powerful subset of commands and statements controlling the IEEE-488 bus.
Most BASIC 4.0 statements are very similar to those used~.in other BASIC languages; however,
there are some statements associated with IEEE-488 bus Ii0 that require discussion. The
following provides a brief overview of some of the statements you will encounter in the various
programs in this guide. Refer to the BASIC 4.0 Reference for more detailed information.
OUTPUT
OUTPUT allows you to send a variable or string over the bus, and it may take on one c$
several forms. A typical syntax is:
In this instance, 7 specifies the interface select code, while 09 is the primary address of the
instrument. FlX is a literal string that will be transmitted to the instruments when the statement~ is executed.
ENTER
ENTER performs the opposite-function,~ allowing the transmission of data from the instru-
ment to the computer. Typical syntax for this statement is;
Again, 7 specifies the interface select code, while 09 represents the primary address of the
instrument. .A$ is a string variable into which incoming data is placed. Keep in mind that
A$ must be dimensioned large enough to hold all Rpected characters. As an alternative,
the ENTER statement-can directly input the data into a numeric variable, assuming that the
proper instrument data format is used.
SPOLL
SPOLL serial polls the instrumentand places its status byte in a numeric variable as follows:
Here again, 709 represents the interface select code and primary address of the instrument.
S is a numeric variable which will contain the decimal value of the status byte after the state-
3
ment is executed. The status byte-can then be checked by ANDing or BIXng S to determine
the status of the required bits. These bits can yield certain information such as reading,overflow
and ready for a new command.
BIT
BIT can be used to detetie the bit status of numeric variables:
In this example, the status of bit 5 of the variable S is placed into A.
TRIGGER
TRIGGER sends a GET (Group Execute Trigger) to a device as follows:
A GET is one of many methods that can be used~& initiate a~ Model 194A +?v+urement~
In order to~~use~~ this form of triggering, the GET t$ger mode must be programmed, and
the A/D converter must be armed. Note that programming a trigger mode over the bus
automatically arms the A/D converter.
ASSIGN
ASSIGN is used to assign an I/O path, as in the following example:
Following ASSIGN execution, the attribute D194 will be associated with the interface code
and primary address. Another form of ASSIGN is used to-define the IiO~buffer:
ASSIGM IZufTU BUFFER k8 ‘~
TRANSFER TRANSFER
TRANSFER is used to perform a rapld I/O data transfer sequence. Usualli, TRANSFER is TRANSFER is used to perform a rapld I/O data transfer sequence. Usualli, TRANSFER is
used with the binary dump feature oft the Model 194A for most~rapid data transfer. Using used with the binary dump feature oft the Model 194A for most~rapid data transfer. Using
this combination, data can be transferred at a rate as high as 90K bytes per second. this combination, data can be transferred at a rate as high as 90K bytes per second.
Typical syntax for TRANSFER is:
TRAHSFER I?11194 TO WUF; COU~KT-i00B,W~Il
In this instance, a total of 1000 bytes will be tr~mitted from the Model 194A to~~the~internal
buffer.
4
STATUS
SX4TUS allows access to certain computer status registers. Most often, this statement is used
to either determine if aii SRQ has occurred, or dear an SRQ interrupt. Typical syntax is:
Here, 7 is the interface select code, and the second 7 is the status register being accessed.
The value of the status register is placed in the variable S when the statement is executed.
ON INTR and ENABLE INTR
These two statements work together to enable interrupts and to tell the computer where to
go for next line execution. A typical ON INTR statement is:
In this case, when the computer detects an IEEE-488 interrupt, it-begins executing the
subroutine at line 4000.
SRQ is the most often used type of interrupt for the IEEE-488 bus. Using BASIC 4.0, SRQ
interrupts are enabled as follows:
Once enabled, an SRQ Wi cause the computer to branch to the line number specified by
the ON INTR statement. Typically, an error handling subroutine will be incorporated at that
point to determine the reason for the SRQ and to handle any other required tasks.
5/6
SINGLE CHANNEL PROGRAMMING
PROGRAMMING CONCEPTS
l Sending command strings to the Model 194A.
l Obtaining data and displaying iton the computer CRT
PROGRAMMING CONSIDERATIONS
At the very least, it will be necessary to send commands to the instrument to set it up as
desired, and to request data back from the unit. The program below demonstrates~ the basic
recess for doing so. Note that if you have a dual-channel unit, you should proceed to
F
rogTam 2.
PROGRAM OPERATION
Program 1 below demonstrates fundamental programming
unit. Figure 1 is a flowchartof the program.
Before we can program the Model 194A, we must place the unit in remote as follows:
Next a prompt for the user to enter the desired command is displayed by the following program statements:
Following execution of these two lines, the command suing resides in a string variable called
Command!& Now we can send the command string to the instrument with the ‘X” character
appended to the string to force command execution:
Since sending any AID (Analog-to-Digital) converter programming command to the instrument will disarm the AID converter (see Table 1), you should always arm the AID converter
before requesting a reading. In this particular program, the AID converter is armed by sen-
ding the T26 command in the following manner:
techniques for a single-channel
7
PUT ,944
I
IN REM3T.E
INPUT COMMAND
STRING
c
OUTPUT COMMAND
STRING TO 194.4
c
ARM AND TRIGGER
/vD CONVERTER
I
r
c
I
Figure 1. Single Channel Operation Flowchart
Note that the immediate trigger mode is used in this instance, so it is not necessary to~~trigger the unit to process a measurement; however, with other tri
to trigger the unit before the unit will collect samples. Once t
processed into a reading, the data is requested and displayed on the computer CRT as follows
(see Figure 2 for ASCII data format):
80 ENTER 70’3; Readings
YM PEItKReading8
er modes, it will be necessary
ose samples are stored and
PB
PREFIX
(GO G-2, G3. GS)
BUFFER
SUFFIX (G2, GS) WITH CF
EOIASSERTED~
N=NORMAL A
0 = OVERFLOW
Z=ZEROED
READING
I = INVALID
MEASUREMENT
RMS = TRMS
A”G = AVERAGE
+PK = +PEAK
-PK = -PEAK
DIF = CHI CH2
RAT = CH1ICH2
DEV I STANDARD DE”,AT,ON
P.P = PEAK TO PEAK
INT= INlEGRAL
DC” = WAVEFORM
RCL = RECALL
+-I
N DCV * 1.2345 E + 0. CH2, 80050 TERMlNATOR
kdST TM,, &&;ToRicRLF
EXFCNENl
~ ~~~
NOTE: SUFFER LCCATDN SHOWS
A I
NUMBER
SAMPLE nnnni, IN WAVE
FORM MODE
Figure 2. ASCII Data Format
Table 1. Commands That Disarm the A/D Converter
Command
Description
I
Recall setup
Function
$P~z?
Number of samples
Filter
Range
Rate
Trigger
w
Z
Delay
7mv-l
RUNNING THE PROGRAM
1. Enter the program into the computer.
2. Run the program by pressing the RUN key. The computer wti promptyou to type in your
command:
9
3. Type in the desired command string and then press ENTER. Note that is not necessary
to add the “X” character as it is automatically added by the program. For example, to program the average function and select autoranging, type in FlRO and press ENTER.
4; Once the measurement is completed and the reading is processed, the data string will
appear on the computer display. A typical example is:
ACQUIRING A WAVEFORM USING ASCII DATA TRANSFER
The Model 194A can be used to capture a waveform and then send the data as a series of
readings representing the individual samples. Each individual data string will represents the
voltage of that-particular sample.
To use the Model 194A in this manner, program the instrument for the waveform (FO) function, and then repeatedly request readmgs until all samples have been transferred. For example, to collect 100 samples and read them into a computer, modify Program 1 as follows:
75 FUR I = 1 TU i0EI
35 HEYT I c ,
! Loop 100 times.
! Loop back for next sample.
When the computer prompts~you for a command, type in ‘~ONO,lOO” (include the quotes
because of the comma) and then press ENTER. You should see 100 successive readings appear on the display. Each reading is the numeric value of that particular sample. These samples
can also be placed into a BASIC array for further processing, if required.
For a larger number of samples, or for higher speed data transfer, refer to the section in this
guide on binary data transfer.
Program 1. Single Channel Operation
10
20
30
40
50
60
70
80
90
100
$10
10
DUAL-CHANNEL PROGRAMMING
PROGRAMMING CONCEPTS
l Basic command programming of a dual-channel Model 194A.
l Obtaining data fmn a dual-channel Model 194A.
l Demonstrating that both channels share a single IEEE-488 output.
l How to turn off an unused channel for maximum speed and to ensure that data comes
only from the desired channel.
PROGRAMMING CONSIDERATIONS
Programming a dual-channel unit is somewhat more complex than a single-channel unit,
even for the most basic measurements. In particular, there are several important aspects~~tokeep in mind:
1. Before sending programming commands to the instrument, select the desired channel
by sending ClX for channel 1, or C2X for channel 2. Doing so will ensure that the com-
mands you send will affect the desired channel. Note that sOme commands such as data
format (G), SRQ (M), and terminator (Y) affect both channels, so it is not necessary to
select the channel before using them.
2. The two channels share a common IEEE-488 output and reading buffer. As a result, there
is no way to dictate which channel has the currentoutput when both channels are running simultaneously. Thus, it will be necessary~for~you use the channel suffii in the data
string (Figure 2) to determine the source of the data. Alternatively, you can use the reading
buffer for storage and request data later.
3. If one channel is not being used, it should be disabled by sending a trigger command
for a tri
ing, se* the co 9 rnmand string CXI7X to disarm channel 1, or send C2XM( to disable
channel 2. Turning off an unused channel will accomplish two things: (1) maximize
throughput for the channel being used, and (2) make sure that data comes only from the
channel in use.
4. Another way to keep the reading from both channels separated is to use the F command
to re-calculate a reading. Even If a reading has already been calculated, you can force
another calculation for the desired channel to place the result in the reading buffer. For
example, send C2FlX to compute the average of the channel 2 measurement and place
the results in the reading buffer. Keep in mind that the other channel must not be running fast enough to overwrite this data between the time it is calculated and the time it
is requested.
er stimulus that will not occur. For example, if you are not using external trigger-
PROGRAM OPERATION
Program 2 below demonstrates dual-channel programming. Figure 3 is a flowchart showing
general program flow.
11
I I
t
ARM AND TRIGGER
CHANNEL 2
READING
I_!
Figure 3. Dual Channel Operation Flowchart
Usually, an instrument is sent a command at the start of a program to return it to some default
state. In the program below, this operation is performed by sending an SDC (Stile&d Device
Clear) as follows:
This statement instructs the Model 194A to assume its power-up (setup 1) configuration.
Next, we must make certain that the instrument is in remote before sending programming
commands as follows:
3M REMOTE 76’3
Now we can program channel 1 and channel 2 as required. For channel 1, we will select
the 32OmV range (Rl) and TRMS function (F2) as follows:
In a similar manner, channel 2 is programmed for the ZOOV range (R4) using the average
function (Fl):
In both cases, you will note that the channel select (C) command is included at the fronts
of the command string containing range and function commands, followed by an execute
(X) character to assure proper channel selection. (Note that the X immediately after the C
command is not required, but it does no harm).
At this point, we have programmed both channels; however, since the range and function
were changed, we must arm both A/D converters. First, for channel 1, we have:
Again, each command string includes the channel selection command prior to the trigger
command that arms the AID converter. Here again, the immediate trigger mode vZ6) is used
so that no further triggering is necessary to start the AID converters. With other trigger sources,
you will be required to apply the necessary trigger stimuli to start the A/D converters after
arming them.
Now that both A/D converters are running and readings are being processed, it is a simple
matter to set up a loop to request and display readings:
This loop repeats indefinitely, with one reading per loop accessed and displayed.
RUNNING THE PROGRAM
1. Enter the program into the computer.
2. Press the computer RUN key tostart the program.
3. The program will send the commands to the instrument and then request readings from
the Model 194A. Note that data will alternate between channel 1 and channel 2 depending on which channel has the most current reading.
USING ONE CHANNEL
In order to use only one channel, program the other channel for an unused trigger source.
For example, to turn off channel 1, modify line 60 as follows:
6’3 OUTPUT 7B9j 6 g tCl:XTTK’ 3
Similarly, to disable channel 2, modify line 70 to read:
In both instances, the disabled channel is programmed for the external trigger mode. Thus,
in order for that~channel to remain disabled, no trigger signal can be applied to the trigger
input~for that channel. Another way to disable a channel is to use T27 which causes only
one trigger; no further triggers will oCcur even with external triter input noise.
SELECTING CHANNEL OUTPUT
As discussed previously, you can dictate which channel has the current-output by programming the desired channel for a particular function (so&as average), and then immediately
requesting a reading. In order to demonstrate this process, eliminate lines 80-110 from Program 2, and add the following lines:
With these modifications, the computer display will alternate between channel 1 and channel 2 readings. Note, however, that one channel may still overwrite the other if there is a
large difference in processing speed between the two channels.
Program 2. Dual-Channel Programming
10
OIM ReadlngBlSOl
20
CLEAR 709
30
RErlOTE 709
40
0UiP”T 709;“CIXRIF:X-
50
0”iP”T 709i”C:XR4FiX”
60
OUTPUT 709i”CIXT?fiX’
70
OUTPlJT 709; ~CZXT26X”
ENTER 709,Readimp
PRINT Reading*
GOT” 80
TN,,
oincnalo” reading string
Return the 194.4 to default conditions
Put the 134 into renotc mode
Program chl far the 320mU range and TRMS
Program ch2 for the 200” range and Rverags
Am channci I
Am channel 2
Get a reading fron the !94A
Print the rcadlng
ReDeat
I5116
SINGLE AND CONTINUOUS
TRIGGER ARMING
PROGRAMMING CONCEPTS
l Sending the arming command ~once with continuous arming.
l Sending the arming command before each trigger with single arming.
l Triggering the measurement with single and continuous arming.
PROGRAMMING CONSIDERATIONS
Before the Model 194A will take a measurement, it must be triggered with the stimulus determined by the selected trigger source: immediate, input signal, external, other channel, or
an IEEE-488 GET, X, or t& command. However, it will notrespond to a trigger unless the
A/D converter is first-armed and ready for a trrgger.
Basically, there are two A/D arming modes: single and continuous. With single arming, the
A/D converter must be re-armed before each trigger. However, in continuous, the A/D converter need be armed only once, as the converter is automatically rearmed after each
measurement.
Over the IEEE-488 bus, arming takes place when the programming command for that particular trigger mode is received. For example, sending l3X (single arm, trigger on GET), arms
the A/D converter. Once armed, the measurement will be initiated when GET (Group Execute Trigger) is received. In this instance, the T3X~command must be sent before each trigger to arm the A/D converter. In contrast, if using continuous GET (TUC), you need send
the command only once before the first trigger, after which the A/D converter will automatical-
ly rearm itself after each measurement.
To summarize, there are several steps to programming and using triggers:
1. Fit select the channel to be armed and triggered. For example, to select channel 1, send
ax.
2. Send the command to select the trigger source and arm the A/D converter. For example,
toselect single, GET, send ‘l’3X.
3. Repeat steps 1 and 2 for the other channel, if desired.
4. Apply the necessary trigger stimulus to initiate the measurement. For example, issue the
GET command to initiate the measurement.
5. If you have selected a single arming mode, remember to re-arm the converter before each
trigger by sending the appropriate command over the bus.
PROGRAM OPERATION
Program 3 below demonstrates single arming using the GET trigger source. Figure 4 is a
flowchart of the program.
Once the unit is in remote, we can program the trigger source and arm the channel 1 A/D
converter as follows:
In this particular instance we have selected the single arm, GET trigger mode (T3X); after
the command is sent, the A/D converter will be armed.
Now that the A/D converters is armed, we can trigger a measurement by sending GET:
The next two lines request a reading from the Model 194A and display a reading on the CRT:
40 ENTER 709;EeadingS
5W PR I t.IT Readings
Here the incoming data string is stored in Readmg$.
One final line necessary to complete the loop is:
Note that this branch goes back to the line containing the re-arm (T3X) command because
a single-arm trigger mode is jn effect. If instead we had branched back only to line 30, only
one reading would be taken the first time through the loop.
18
SENDGETTO
TRIGGER READING
Figure 4. Single Arming Flowchart
RUNNING THE PROGRAM
1. Enter the program into the computer.
2. Press the RUN key to execute the program.
3. The prc~gram will setup the Model 194A for the single, GET trigger mode, bigger a reading,
and display it; A loop is set up to repeat the sequence indefinitely.
4. To demonstrate the importance of reaming, modify the pmgram as follows:
60 GOTO 38 ! Laop back to trigger.
5. Run the modified program and note that only one reading from channel 1 is displayed.
With this change, the program now branches back to the trigger statement (line 30) in-
stead of the arming statement (line 20). As a result, only one measurement and reading
from channel 1 are processed on the fiist~ time through.
CONTINUOUS ARMING
Program 3 can be modified for continuous, GET arming by changing the lines below. Figure
5 shows a flowchart for this modification.
19
20 O,JTPClT 70’3; 6 ~I:l:<T;?)<’ J ! Program continuous arm, trigger on
GET.
co GOT0 30
Upon running this program, you will note that repeated readings appear on the computer
display. Now, however, it is n&necessary to %rmthe converter each time--merely trigger
it--to obtain each reading.
l Programming the h@ument to generate an SRQ on reading done and error conditions.
l Servicing the SRQ and determining the exact condition that caused it.
l Taking appropriate action tin the SRQ condition.
PROGRAMMING CONSIDERATIONS
The SRQ line on the IEEE488 bus gives the user a great deal of flexibility in determining
if the instrument~requires controller servicing. By sending the appropriate command (Table
2), you can program the Model p4A to notif
variety of different conditions including rea
done), front panel button pressed, reading done, ready for cotiand, and a number of er-
ror conditions. The instrument-can be programmed for multiple SRQ conditions simply by
adding up the command values. For example, to program for reading done (M8) and error
(M32), M40 would be used.
Once the controller has received the SRQ, it can serial poll the instxument and obtain the
status byte to determine whether that instrument did in fact request service, and if so, what
conditions caused it to do so (Figure 6). For data and error conditions (bits 1 and 5 respectively), you can check the Ul and U;? status words to determine the exact condition that caused
the SRQ, as shown in Figures 7 and 8.
the controller when it re uires service for a
kg oveflow, data (buffer ?i.zll, ‘/2 full, plotter