I think my problem is related to the VISA Read STB function. This is at least where it crashes. According to the help, the operation for GPIB / serial works differently: http://zone.ni.com/reference/en-XX/help/371361H-01/lvinstio/visa_read_stb/.
I use the status byte because there are several operations which need to await eachother. Circumventing VISA Read STB continuously gives timeout errors. Is there an alternative to VISA Read STB in serial?
Yes. If supported, adding ;*OPC? to a command turns it into a query. When the operation is complete, a "1" will be returned to the buffer. Until then, the read will sit idly until either a) something (the "1") is returned to the buffer or b) VISA timeout.
Consult your equipment manual to see if this command is supported, and if so, what commands are compatible.
I tried this, but it doesn't recognize *opc?.
I attached my test-vi, so you can think along with me if you want. It only works if I disable the status byte (frame 4), but I want the status byte to be included.
Thanks a lot so far!
Sorry, I'm not a computer where I can see the code. Ordinarily the STB and the Operation Complete are used for the same purpose, only with OPC? it's more or less automatic. You don't have to poll to check the status. In fact, I think the STB is checked internally when executing the *OPC? command.
I use the status byte because I have to do a sequence of operations, which take each a variable amount of time. I want to check if the previous operation has finished, in order to start the new one.
Sorry, you read the post before I had a chance to edit it! I apologize, but please read the message again. 😉
It seems that my VI doesn't recognize the *OPC? command. If I just add ;*OPC? to the command it gives the entire string back, without doing anything. Do you by any change have an example of proper usage of OPC? Also, I can't find it in the manual of my device, so could it be that it is not defined?
If you could upload the manual, I'm sure we can help you out. 🙂
What device are you talking to? What commands are you currently sending it?
It's a monochromator. I set the wavelength to select from a white light source, using e.g. '?NM' or '500 NM'.
I attached the manual.