MDO3000 Programmer Manual.pdf - 第1022页
Status and Events /* Acqu ire wave form da ta */ ACQUIRE:STATE ON /* Set up the measurement parameters */ MEASUREMENT:I MMED:TYPE AM PLITUDE MEASUREMENT:I MMED:SOURCE CH1 /* Wait until t he acquisitio n is complete befo …

Status and Events
Service Reques
t Method: Enable the OPC bit in the Device Event Status Enable
Register (DESER) and the Event Status Enable Register (ESER) using the DESE
and *ESE commands.
You can also enable service requests by setting the ESB bit in the Service Request
Enable Register (SRER) using the *SRE command. When the operation is
complete, the oscilloscope will generate a Service Request.
The same command sequence using the *OPC command for synchronization
looks like this
/* Set up conditional acquisition */
ACQUIRE:STATE OFF
SELECT:CH1 ON
HORIZONTAL:RECORDLENGTH 1000
ACQUIRE
:MODE SAM PLE
ACQUIRE:STOPAFTER SEQUENCE
/* Enab le the st atus registe rs */
DESE 1
*ESE 1
*SRE 32
/* Acq
uire wa veform data */
ACQUIRE:STATE ON
/* Set up the measurement parameters */
MEASUREMENT:IMMED:TYPE AMPLITUDE
MEASUREMENT:IMMED:SOURCE CH1
/* Wait until the acquisition is c omplete befo re taking the
mea
surement*/
*OPC
Th
e program can now do different tasks such as talk to other devices. The SRQ,
when it comes, interrupts those tasks and returns control to this task.
/* Take amplitude measurement */
MEASUREMENT:IMMED:VALUE?
Example of Using the
*OPC? Q uery
The *OPC? query places a 1 in the Output Queue once an operation that generates
an OPC message is complete. The *OPC? query does not return until all pending
OPC operations have completed. Therefore, your time-out must be set to a time at
least as long as the longest expected time for the operations to complete.
The same command sequence using the *OPC? query for synchronization looks
like this:
/* Set up single sequence acquisition */
ACQUIRE:STATE OFF
SELECT:CH1 ON
HORIZONTAL:RECORDLENGTH 1000
ACQUIRE:MODE SAMPLE
ACQUIRE:STOPAFTER SEQUENCE
MDO4000/B/C, MSO/DPO4000B and MDO3000 Series Oscilloscopes Programmer Manual 3-11

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