Showing results for 
Search instead for 
Did you mean: 

Should I use VISA Clear before *OPC?

I have two questions based on a SRQ Event Handling example given on NI website "Using Service Requests in your GPIB application"  ( The diagram is attached. 


I would like change the wavelength of a tunable laser (Santec Tunable Laser TLS -510) and be sure the operation is complete before I proceed.


In general I can use *OPC or *OPC? to ensure operation is complete. However, the device does not support *OPC command. The command *OPC? is based on message available bit in the status byte register. I have found an example on NI website using *OPC? command, the image is attached.Here are my questions:


1. In the example, VISA Clear is not used. However, I believe the output buffer should be cleared with VISA Clear, if operation complete will be based on checking message available bit.What do you think?


2. In order to use Wait for RQS , the VISA Enable event should be used as in the example. Do you think, to ensure that SRQ event does not respond to previous SRQ events, I should also use VISA Discard events after enabling VISA Event?


Thank You,



0 Kudos
Message 1 of 7

One more questions. Isn't is  also a good practice to clear the status byte register with *CLS before we wait for a service request?

0 Kudos
Message 2 of 7

Hello Gunay,


Can you post the link where you've found the example?

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 3 of 7

Hi Thierry,


He is the link of the NI example on using *OPC? , it is example 2:




0 Kudos
Message 4 of 7

Hello Gunay,


I think all the suggestions you made can be usefull if you really want to make sure that every step is done before going on to the next step.

I also think that the example from the NI website works properly without your ideas, but it's ofcourse never bad to do an extra check. So normally it won't cause any errors if you implement your suggestions.


Kind regards,


Nico Lammens

0 Kudos
Message 5 of 7

Thanks Nico. 

I will post if something with my implementation goes wrong. 

0 Kudos
Message 6 of 7

Thanks Nico. 

I will post if something with my implementation goes wrong. 

0 Kudos
Message 7 of 7