10-15-2018 09:39 PM
I'm new to this area. I'm trying to control multiple instruments from a single program. My trouble is that i don't know how to check if an instrument has finished it action. I tried to wait for gpibstatus flag (e.g. IO Complete, End), but it seems its only for communication level. When I want to generate a signal and capture it, it could take 1 or 2 seconds before instruments actually sending and receiving a signal for the first time. So is there a way to monitor this action or certain status bit to check when action is done?
Thank you
Solved! Go to Solution.
10-16-2018 05:34 AM
It depends on the instrument. Many implement an *OPC? query which you can use to get the current command status from an instrument.
10-16-2018 10:14 AM - edited 10-16-2018 10:21 AM
What instruments specifically? As crossrulz mentioned some instruments implement *OPC? is a IEEE488.2 querry to check if the current operation is complete. But 488.2 is poorly supported. It works on most newer instrument from major vendors, but support varies on a lot of other instruments.
Older (<2000) instruments and those that only support IEEE488 usually rely on status registers. You will have to read the manual and look at the instruments Status Register Model. Typically you would issue a series of commands the last command being to set the SRQ flag when complete all commands are completed. Then your code would wait patiently, reading the SRQ register in a loop until the correct bits are set before you send more commands. Its sometimes a little daunting at first glance, but once you get it working your synchronisation will run smoothly. You won't have code that fulls of little random time delays that make debugging impossible and cause errors on every second execution.
Here's a resource to get started with status registers - http://www.ni.com/white-paper/2927/en/
Edit: Here's a great resource! - http://www.ni.com/swf/presentation/us/visa/
If you have questions about specific instruments, or LabVIEW drivers then post them here. Also for real help, post code or describe your measurement sequence.
Craig