10-17-2005 01:28 PM
10-17-2005 07:18 PM
The *WAI command blocks the interface bus so I don't recommend it. A good way is to use the *OPC command that makes the instrument generate an OPC standard event when the measurement completes. It can be detected by reading Standard Event Register or Status Byte Register. This approach can be used for any other instruments that understand SCPI language.
// Make the instrument transmit OPC event to the Status Byte
*ESE 1
// Clear registers, Initiate measurement
*CLS;:INIT;*OPC
// Loop until STB indicates the ESB (0x20) bit
do {
(Read Status Byte)
} while( (STB & 0x20) == 0x00)
// Measurement complete
FETC?
(Read Response)
Mind that actual Do/While loop in your app must also process the case that the measurement was ABORted without completion. In this case the ESB bit on the Status Byte Register will not be generated, therefore better to have other loop-exit conditions.
10-20-2005 02:59 PM
10-20-2005 03:01 PM
10-20-2005 07:16 PM