Remote
Programming
INPUT
SYNTAX
In some instances, a terminator is automatically transrnit-
ted at the end of the controller's output string. For exam-
ple, in Fluke BASIC, the PRINT statement always finishes
with a CR
LF
pair. If a controller does not have this
feature, the programmer must transmit a terminator explic-
itly.
The 8840A accepts alphabetic characters in either upper or
lower case. Spaces, commas, and control codes are ignored
and are not placed in the input buffer. If the 8840A
receives
a
group of terminators (such
as
CR LF or CR
LF
EOI), only a single terminator is loaded into the input
buffer. Numeric values used in
PUT
commands may be in
NRl, NR2, or NR3 format
as
described in the IEEE-488
Codes and Formats Recommended Practice. (These corres-
pond to the signed integer, real number, and real-number-
with-exponent formats described under the
N
command.)
For reference, 'Figure
3-8
shows how the 8840A interprets
messages.
Illegal commands
(e-g., F9) generate
an
enor message, but
are otherwise ignored, and do not affect the instrument's
configuration.
Example Explanation
4,*
Fg"
This would load the output buffer
with an error message and select F1
(established by the
*
command).
3-39.
Syntax
Rules
Four syntax rules should be followed when constructing
input command strings. They are:
RULE
1:
Read output data only once.
To prevent old (previously read) data from being read
a second time by mistake, the output buffer is always
cleared after it has been read. If the output buffer is
read twice without
an
intervening output command,
the 8840A will not respond to the second attempt to
read the output buffer. (However, if the
8840A
is in
TO, no intervening command is necessary.)
RULE
2:
Use no more than one output command per
input command string.
Because the 8840A has only one output buffer, it
writes new data over old. If
an
input command string
contains more than one output command, only the
data from the last command
can
be read.
Example
"F1
T3
?
F2
?"
"F2
R3 SO"
Explanation
Improper construction. The second
trigger writes over the first. To
obtain two readings, send two
complete command strings (sepa-
rated by terminators).
Correct construction. The string
contains only one output com-
mand.
Correct construction. It is permissi-
ble for
a
string not to contain an
output command.
RULE
3:
Read the output data generated by one input
command string before sending the next input com-
mand string.
Output data remains available in the output buffer
until it is read, or until the next input command string
is received.
As
soon as the controller finishes reading
the output buffer, or as soon as the
8840A
receives a
new input terminator, the Data Available bit in the
serial poll register is set
false. When
this
bit is false,
data
can
no longer
be
read from the output buffer.
Therefore,
an
output string which is available must
be
read by the controller before, rather than after, the
next input command string is sent.
Rule
3
is most evident in the external trigger mode,
and is best demonstrated by a programming example.
The following program is written first incorrectly, and
then correctly, in Fluke BASIC using the 1722A
Instrument Controller.
Incorrect example:
100
PRINT
@3, "TI
?*
200
PRINT
@3,
"F4"
300
INPUT
@3,
A
In this inconect example, the INPUT statement is
located incorrectly for reading the measurement
data
from line 100. The new input command string
"F4"
disallows the reading of data from the output buffer.
Correct example:
100
PRINT
83,
"T1
7"
200
INPUT
@3,
A
300
PRINT
@3,
"F4"
In this example, the reading taken at line 100 is read
at
line 200. Then the F4 command is sent. Note that in
the external trigger mode, the reading from line
100
flashes on the 8840A display too briefly to see.
This
is
because the function change at line
300
blanks the
display until the next trigger.
The previous example could also
be
correctly pro-
grammed as follows:
100
PRINT
@3, "TI
?
F4"
200
INPUT
@3,
A
Rule 4: If an input command string contains a trigger,
enter the commands in the following order:
a
Commands to configure the instrument (if any).
b. The trigger command
c.
Commands to re-configure the instrument (if
any).
The principle behind this rule is that the 8840A executes
all commands in the exact order they are received, from
left to right as written.
Example Explanation
"F3 F4
?"
Improper construction. F3 is effectively
discarded.
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com