LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Communication issues with COM port

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?

0 Kudos
Message 11 of 27
(566 Views)

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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 12 of 27
(559 Views)

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!

0 Kudos
Message 13 of 27
(521 Views)

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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 14 of 27
(518 Views)

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.

0 Kudos
Message 15 of 27
(515 Views)

Sorry, you read the post before I had a chance to edit it!  I apologize, but please read the message again.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 16 of 27
(510 Views)

Hi Bill,

 

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?

0 Kudos
Message 17 of 27
(498 Views)

If you could upload the manual, I'm sure we can help you out.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 18 of 27
(490 Views)

What device are you talking to?  What commands are you currently sending it?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 19 of 27
(484 Views)

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.

0 Kudos
Message 20 of 27
(480 Views)