Getting Started
2-17
Instead of sending ...
:trig:coun 1;:trig:del 1;:trig:tim 1
You can send ...
:trig:coun 1;del 1;tim 1
Notice that the colon for the additional commands is not in-
cluded. Remember, when a colon (not preceded by a semico-
lon) is seen, the path pointer moves down to the next
command level. For example:
:trig:del 1;tcon:prot asyn
When this message is sent, the path pointer moves down one
command level for the DELAY and TCONFIGURE com-
mands. The colon after the TCONFIGURE command then
moves the pointer down to the next command level and en-
ables PROTOCOL.
A few important points:
1. The path pointer can only move down. It cannot be
moved up a level. (Note: It can be reset to the root mode
by a preceding colon. For example, :ARM:LAY2:
SOUR MAN; :TRIG:SOUR MAN.)
2. Each new message (line) must begin with the root com-
mand.
3. The colon at the beginning of a program message is op-
tional.
4. The end of a program message moves the path pointer
back to the root; so does a leading colon.
5. Any time one or more query commands are included in
a program message, the Model 2001 must be addressed
to talk to send the response message to the computer.
2.6.8 Programming examples
The following programming examples are written in the
Hewlett-Packard BASIC 4.0 programming language. The
programs assume that the Model 2001 is set to primary ad-
dress 16.
Programming example #1 Default DC voltage read-
ing
The following code fragment resets the Model 2001 to a de-
fault configuration and gets a DC voltage reading:
100 OUTPUT 716;“:syst:pres”
110 OUTPUT 716;“:fetch?”
120 ENTER 716;A$
130 PRINT A$
Line 100 Return Model 2001 to :SYSTem:PRESet default
configuration (DC volts, autorange, 1 PLC, filter
enabled, 6.5 digits).
Line 110 Request new reading.
Line 120 Address to talk.
Line 130 Display reading, status, units, time-stamp, read-
ing number, and channel.
Programming example #2 High accuracy DC volt-
age reading
The following code fragment configures the Model 2001 for
high accuracy DC voltage readings and gets one reading:
100 OUTPUT 716;“:syst:pres”
110 OUTPUT 716;“:volt:dc:nplc 10”
120 OUTPUT 716;“:fetch?”
130 ENTER 716;A$
140 PRINT A$
Line 100 Return Model 2001 to default configuration.
Line 110 Change integration time to 10 PLC (and resolu-
tion to 7.5d).
Line 120 Request new reading.
Line 130 Address to talk.
Line 140 Display reading status, units, time-stamp, read-
ing number, and channel.
Programming example #3 High speed DC voltage
readings
The following code fragment configures the Model 2001 for
high speed DC voltage readings, stores 100 readings, and
sends the readings over the bus:
100 OUTPUT 716;“:syst:pres”
110 OUTPUT 716;“:volt:dc:nplc 0.01”
120 OUTPUT 716;“:trac:clear”
130 OUTPUT 716;“:trac:feed calc”
140 OUTPUT 716;“:trac:egr full”
150 OUTPUT 716;“:trac:poin 100”
160 OUTPUT 716;“:trac:feed:cont next”
170 OUTPUT 716;“:trac:data?”
180 ENTER 716;A$
190 PRINT A$
Line 100 Return Model 2001 to default configuration.
Line 110 Change integration time to 0.01 PLC.
Line 120 Clear all stored readings.
Line 130 Perform any math before storing readings.
Line 140 Store full data group (reading, reading number,
units, timestamp, status, and channel).
Line 150 Set buffer count to 100 readings.
Line 160 Start storing, stop when done.