MDO3000 Programmer Manual.pdf - 第1023页
Status and Events Example of U sing the BUSY Query The BUSY? query allows you to find out whether the oscilloscope is busy processing a command that has an extended processing time such as single-sequence acquisition. The…

Status and Events
/* Acqu ire wave
form da ta */
ACQUIRE:STATE ON
/* Set up the measurement parameters */
MEASUREMENT:IMMED:TYPE AMPLITUDE
MEASUREMENT:IMMED:SOURCE CH1
/* Wait until the acquisition is complete before taking the
measuremen
t*/
*OPC?
Wait for re
ad from Output Queue.
/* Take amplitude measurement */
MEASUREMENT:IMMED:VALUE?
This is the simplest approach. It requires no status handling or loops. However,
you must set the controller time-out for longer than the acquisition operation.
Example of Using the *WA I
Command
The *WAI
command forces completion of previous commands that generate
an OPC message. No commands after the *WAI are processed before the OPC
message(s) are generated
The same command sequence using the *WAI command for synchronization
looks like this:
/* Set up conditional acquisition */
ACQUIRE:STATE OFF
SELECT:CH1 ON
HORIZONTAL:RECORDLENGTH 1000
ACQUIRE:MODE SAMPLE
ACQ
UIRE:STOPAFTER SEQUENCE
/* Acquir e waveform data */
ACQUIRE:STATE ON
/* Set up the measurement parameters */
MEASUREMENT:IMMED:TYPE AMPLITUDE
MEASUREMENT:IMMED:SOURCE CH1
/* Wait until the acquisition is complete before taking
the measu rement*/
*/
*WAI
/* Take amplitude measurement */
MEASUREMENT:IMMED:VALUE?
The controller can continue to write commands to the input buffer of the
oscilloscope, but the commands will not be processed by the oscilloscope until
all in-process OPC operations are complete. If the input buffer becomes full,
the controller will be unable to write commands to the buffer. This can causea
time-out.
3-12 MDO4000/B/C, MSO/DPO4000B and MDO3000 Series Oscilloscopes Programmer Manual

Status and Events
Example of Using the
BUSY Query
The BUSY? query
allows you to find out whether the oscilloscope is
busy processing a command that has an extended processing time such as
single-sequence acquisition.
The same command sequence, using the BUSY? query for synchronization, looks
like this:
/* Set up conditional acquisition */
ACQUIRE:STATE OFF
SELECT:CH1 ON
HORIZONTAL:RECORDLENGTH 1000
ACQUIRE:MODE SAMPLE
ACQUIRE:
STOPAFTER SEQUENCE
/* Acqu ire waveform data */
ACQUIRE:STATE ON
/* Set up the measurement parameters */
MEASUREMENT:IMMED:TYPE AMPLITUDE
MEASUREMENT:IMMED:SOURCE CH1
/* Wait
until t he acquisitio n is com plete before taking
the mea surement */
While B USY? keep looping
/* Take amplitude measurement */
MEASUREMENT:IMMED:VALUE?
This sequence lets you create your own wait loop rather than using the *WAI
command. The BUSY? query helps you avoid time-outs caused by writing too
many commands to the input buffer. The controller is still tied up though, and
the
repeated BUSY? query will result in bus traffic.
Messages
The information contained in the topics above covers all the programming
interface messages the oscilloscope generates in response to commands and
q
ueries.
For most messages, a secondary message from the oscilloscope gives detail about
the cause of the error or the meaning of the message. This message is part of the
message string and is separated from the main message by a semicolon.
Each message is the result of an event. Each type of event sets a specific bit inthe
SESR and is controlled by the equivalent bit in the DESER. Thus, each message
is associated with a specific SESR bit. In the message tables, the associated SESR
bit is specified in the table title, with exceptions noted with the error message text.
No Event
The following table shows the messages when the system has no events or status
to report. These have no associated SESR bit.
MDO4000/B/C, MSO/DPO4000B and MDO3000 Series Oscilloscopes Programmer Manual 3-13

Status and Events
Table 3-4: No Ev
ent Messages
Code Message
0 No events to re
port; queue empty
1
No events to r
eport; new events pending *ESR?
Command Error
The following table shows the command error messages generated by improper
syntax. Check that the command is properly formed and that it follows the rules
in the section on command Syntax.
Table 3-5: Command Error Messages (CME Bit 5)
Code Message
100
Command error
101 Invalid character
102
Syntax error
103 Invalid separator
104 Data type error
105
GET not allowed
108 Parameter not allowed
109 Missing parameter
110
Command header error
112 Program mnemonic too long
113
Undefined header
120 Numeric data error
121 Invalid character in numeric
123 Exponent too large
124 Too many digits
130
Suffixerror
131
Invalid suffix
134
Suffix too long
140
Character data error
141 Invalid character data
144
Character data too long
150
String data error
151 Invalid string data
152
String data too long
160 Block data error
161 Invalid block data
170
Command expression error
171 Invalid expression
3-14 MDO4000/B/C, MSO/DPO4000B and MDO3000 Series Oscilloscopes Programmer Manual