Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Read status byte in VISA 5.4

I am controlling a Rohde Schwarz FSP and have things working well, using a GPIBSession.  I am trying to set it so that I enable the Operation Complete bit and then use a timer to periodically check the Status Byte.  To set up the Operation Complete bit, I am sending the following:

"*CLS"           

"*ESE 1"           

"*SRE 32"

I can read back the ESE and SRE using the *ESE? and *SRE? queries and get the correct response to indicate that the enables are set correctly.  I then put the spectrum analyser into a Single Sweep mode and trigger the sweeps... when I query the ESR or STB ("*ESR?" and "*STB?") using a timer in a loop the reply is always 0.  If is use the ReadStatusByte, it also returns 0...

 

If I used the *OPC? / *OPC? construct, it will wait and then complete once the required sweeps are complete.  I don't like this as it locks out control and I need to rely on a calculated timeout to prevent a hang-up.

 

I am trying to avoid using Events as I prefer to know where my code is.  There don't seem to be any up-to-date examples for using NI-VISA 5.4 in Visual Studio 2012 (Visual Basic).

 

Thanks for any clues...

 

 

0 Kudos
Message 1 of 2
(4,292 Views)

Hello, 

The standard way to achieve this is by using events. here is a link that you can find examples to wait for service requests : http://cdn.rohde-schwarz.com/dl_downloads/dl_common_library/dl_manuals/gb_1/f/fsp_1/FSP_OpMa_en.pdf

 

Look in chapter 7.

 

Hope this helps.

0 Kudos
Message 2 of 2
(4,184 Views)