Chapter 5
S Mode Functions — stat
©
National Instruments Corporation
5-47
A detailed description of the conditions under which each bit in status is set or cleared can be
found in Appendix C,
Status and Error Message Information
In general, the GPIB-232/485CT-A updates the first three status variables at the end of each
programming message. It updates the fourth status variable,
count
, after a
cmd
,
rd
, or
wrt
function. The errors reported correspond to the previous programming message. For example,
if you call
wrt
and then
stat s
, any errors returned to you correspond to errors in the
wrt
programming message, not
stat
. However, if status is returned in continuous mode, the
status information corresponds to the current programming message. For example, suppose
you called
stat c s
to set up continuous status reporting. After reading the status
information returned from the
stat
call, you call
wrt
. The GPIB-232/485CT-A then returns
the status information that corresponds to the
wrt
message.
When you want to begin continuous status reporting, send the
stat c s
,
stat c n
, or
stat
c n s
programming message. Status information is immediately returned indicating the
current status conditions. When you call
stat
with both
s
and
n
the numeric status is always
returned first.
Notice that when you send several programming messages to the GPIB-232/485CT-A, it
buffers them and processes each one without any delay in between. However, if you enable
continuous status reporting and check the status of each programming message before
sending the next, the GPIB-232/485CT-A waits for each subsequent programming message
to arrive at the serial port before processing it. This slows down the overall performance of
your program. If speed is a primary concern, disable continuous status reporting.
The continuous status setting remains in effect until you call
stat
again, call
onl
, or you turn
off the GPIB-232/485CT-A.
Example 1
10
PRINT #1,"stat n"
'Get GPIB-232/485CT-A status.
20
'GPIB-232/485CT-A responds with:
30
'340<CR><LF>0<CR><LF>0<CR>
40
'<LF>0<CR><LF>. Now read
50
'status into variables.
60
INPUT#1,STATUS%,GPIBERR%,SPERR%,COUNT%
70
'Go to error routine at 500 if error.
90
IF STATUS% < 0 THEN GOTO 500
100
'Go to SRQ service routine
110
'if SRQ is asserted
120
IF (STATUS% AND &H1000) THEN GOTO 400
410
' Place code here to service SRQ.
500
'Print GPIB-error and serial-error
'values to determine what errors
530
'occurred.