MDO3000 Programmer Manual.pdf - 第1018页

Status and Events NOTE. The *OPC c ommand form can also be used to cause an SRQ to be generated upon completion of all pending operations. This r equir es that the ESB (Event Status Bit, bit 5) of the SRER (Service Reque…

100%1 / 1158
Status and Events
Synchronizat
ion M ethods
Overview
Although most commands are completed almost immediately after being received
by the oscilloscope, some commands start a process that requires time. For
example, onc
e a single sequence acquisition command is executed, depending
upon the applied signals and trigger settings, it may take an extended period
of time before the acquisition is complete. Rather than remain idle while the
operation is in process, the oscilloscope will continue processing other commands.
This means that some operations will not be completed in the order that they
were sent. Furthermore, sometimes the result of an operation depends upon the
result of
an earlier operation. A first operation must complete before the next
one is processed.
In order
to handle these situations, the oscilloscope status and event reporting
system allows you to synchronize the operation of the oscilloscope with your
application program, using the Operation Complete function. Note, however,
that only some operations are able to take advantage of this function; a table is
provided below of commands that support this.
The following commands are used to synchronize the oscilloscope functions
using Operation Complete. See examples of how to use these commands later
on in this section:
*OPT? sending the *OPC command will set bit 0 of the SESR (Standard
Events Status Register). The bit will only be set high when all pending operations
tha
t generate an OPC message have finished execution. (The SESR is queried
using *ESR?)The
*OPC? query form returns 1 only when all operations have
completed, or a device clear is received.
*WAI prevents the oscilloscope from executing further commands or queries
until all pending commands that generate an OPC message are complete.
BUSY? returns the status of operations: 1 means there are pending operations,
0 means that all pending operations are complete.
NOTE. Some OPC operations may require an extended period of time to complete
or may n ever complete. For example, a single sequence acquisition may never
complete when no trigger event occurs. You should be aware of these conditions
and tailor your program accordingly by:
setting the timeout sufciently for the anticipated maximum time for the
operation and
handle a timeout appropriately by q uerying the SESR (*ESR?) and event queue
(EVMsg? or ALLEv?).
MDO4000/B/C, MSO/DPO4000B and MDO3000 Series Oscilloscopes Programmer Manual 3-7
Status and Events
NOTE. The *OPC c
ommand form can also be used to cause an SRQ to be
generated upon completion of all pending operations. This requires that the
ESB (Event Status Bit, bit 5) of the SRER (Service Request Enable Regiser) is set,
and the OPC bit (bit 0) of the DESR (Device Event Status Enable Register) and
the ESER (Event Status Enable Register) are set. (The SRER is set/queried using
*SRE. The DESR is set/queried using DESE. The ESER is set/queried using *ESE.)
Only a subset of oscilloscope operations support the Operation Complete function
(OPC):
Table 3-3: Oscilloscope operations that can generate OPC
Command Conditions
ACQuire:STATE <non-zero NR1> | ON |RUN Only when in single s equence acquisition
mode
:AUTOSet < EXECute | UNDo >
CALibrate:INTERNal
CALibrate:INTERNal:STARt
CALibrate:FACtory STARt
CALibrate:FACtory CONTinue
CALibrate:FACtory PREVious
CH<x>:PRObe:AUTOZero EXECute
CH<x>:PRObe:DEGAUss E XECute
DIAg:STATE EXECute
FACtory
HARDCopy
HARDCopy START
MASK:TESt:SRQ:CO M PLetion (1|ON) upon completion of test
MASK:TESt:SRQ:FAILure (1|ON) upon failure of test
:POWer:RIPPle < VERTAUTOset |
VERTDEFault >
RECAll:MASK <le>
RECAll:SETUp (<le as quoted
string>|FACtory)
RECAll:WAVEform <.ISF or .CSV le >,<
REF1|REF2|REF3|REF4 >
:RF:REFLevel AUTO
*RST
SAVe:IMAGe < le as quoted string>
SAVe:SETUp <le as quoted string>
SAVe:WAVEform < source wfm >, (<
REF1|REF2|REF3|REF4 >|< le >)
3-8 MDO4000/B/C, MSO/DPO4000B and MDO3000 Series Oscilloscopes Programmer Manual
Status and Events
Table 3-3: Oscilloscope operations that can generate OPC (cont.)
Command Conditions
TEKSecure
:TRIGger:A SETLevel
Example of Acquiring
and Measur
ing a
Single-Sequence
Waveform
For example, a typical application might involve acquiring a single-sequence
waveform
andthentakingameasurementontheacquiredwaveform. Youcould
use the following command sequence to do this:
/** Set u
p conditi onal acquisit ion **/
ACQUIRE:STATE OFF
SELECT:CH1 ON
HORIZONTAL:RECORDLENGTH 1000
ACQUIRE:MODE SAMPLE
ACQUIRE:STOPAFTER SEQUENCE
/** Ac
quire w aveform data **/
ACQUIRE:STATE ON
/** Set up the measurement parameters **/
MEASUREMENT:IMMED:TYPE AMPLITUDE
MEASUREMENT:IMMED:SOURCE CH
1
/** Tak e amplitude measurement **/
MEA
SUREMENT:MEAS1:VALUE?
The acquisition of the waveform requires extended processing time. It may not
fin
ish before the oscilloscope takes an amplitude measurement (see the following
figure). This can result in an incorrect amplitude value.
Figure 3-7: Command Processing Without Using Synchronization
To ensure the oscilloscope completes waveform acquisition before taking the
measurement on the acquired data, you can synchronize the program using *WAI,
BUSY, *OPC, and *OPC?.
MDO4000/B/C, MSO/DPO4000B and MDO3000 Series Oscilloscopes Programmer Manual 3-9