Chapter 3 3-55
Programming Examples
Status Register–Determine When a Measurement is Done
Status Register–Determine When a
Measurement is Done
This C programming example does the following:
• Open an HP-IB session at address 18.
• Clear the analyzer.
• Reset the analyzer.
• Clear the status byte of the analyzer.
• Put the analyzer in a single sweep.
• Set the input port to the 50 MHz amplitude reference.
• Set the analyzer center frequency to 50 MHz, resolution bandwidth
to 300 kHz.
• Set the analyzer to 10 MHz.
• Initiate the measurement.
• Set the service request mask to assert SRQ when either a
measurement is completed or an error message has occurred.
• Configure the computer to respond to an interrupt, open a context,
install the handler, and enable it.
• Send an undefined command to the device.
• Averaging the successive measurements.
• Set video averaging to 20 sweeps.
• Turn Average On.
• Initiate a measurement.
• Wait until SRQ is generated and for the handler to be called, Print
something while waiting. When interrupt occurs it will be handled
by interrupt handler.
• When an interrupt occurs, recognize it.
• Report the nature of the interrupt on the HP ESA analyzer.
• Disable and uninstall the interrupt handler.
• Clear the status register of the analyzer.
• Clear the status byte of the analyzer.
• Close the Session.
• Interrupt handler: Trigger event handler. Make sure it is an SRQ
event, ignore if stray event. If it is SRQ, get the status byte and