LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial read and write with an instrument that has no flow control

Solved!
Go to solution

I have a gaussmeter that has no built in flow control and I keep getting the error 

"VISA: (Hex 0xBFFF0015) Timeout expired before operation completed."

I'm using the example included with labview called "Continuous Write and Read.vi"

My settings look like this. The port is correct (com4) and the command "log status" is a legitimate command according to my instrument's manual. Not sure what I need to do, but it must be something simple.

0 Kudos
Message 1 of 10
(2,995 Views)

And where is the manual for your instrument?  Can't really give any advice without knowing how the instrument communicates (data structure, etc).


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 2 of 10
(2,983 Views)

Thank you for taking a look. http://www.integritydesign.com/images/Integrity/VLF%20Meter%20Operation%20manual.pdf

Here is the manual, it's not great. It says there is flow control but my coworker has talked to them and said that they did not actually implement it. It has an rs232 command set at the end.

0 Kudos
Message 3 of 10
(2,972 Views)
Solution
Accepted by topic author crash_override

I was really hoping to see what the data format coming out of the instrument was.  But considering it is expecting Hyperterminal, we can make some assumptions.

 

First of all, the End Read on Termination Character should be turned ON.  This will tell the VISA Read to stop reading when the termination character is read.  In this case, it is the Line Feed character (\n, 0xA).

 

Secondly, you need to make sure you are appending an End Of Line character to your commands.  I cannot tell if you have that in your command control or if you are adding it in your code (I recommend the later).

 

I would also send the "display off" command to keep the instrument from just spitting out data while you are trying to configure it.  When you are ready for solid measurements, use the "display on" command.

 

You should also change your Write button to be a "Latch When Released" mechanical action.  This way you only send the command once instead of each time the loop iterates.


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 4 of 10
(2,944 Views)

Thank you, I feel I'm getting closer. I followed your directions but it seems to give me the 

VISA: (Hex 0xBFFF0015) Timeout expired before operation completed.

 

when it gets to the Visa Read code. I have included an example of what this meter is supposed to spit out. 

0 Kudos
Message 5 of 10
(2,923 Views)
Solution
Accepted by topic author crash_override

Where does that text file come from?

 

You might want to try a carriage return, 0x0D or decimal 13 instead of a line feed (0x0A, decimal 10).

 

It would help if you attached your actual VI.  I don't like using the NI examples for Serial port comms, as they tend to lean towards some bad practices for serial communication.   I personally like to add the termination character in the string that is actually being written.  And if you do that, make sure the string is in \code display when you enter either a \r or \n.

0 Kudos
Message 6 of 10
(2,920 Views)
Solution
Accepted by topic author crash_override

Do you know the maximum length of the data being read? What I do when reading from serial is calculate the timeout based on the BAUD rate and the expected data size. I then add a bit extra. This has worked extremely well for me.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 7 of 10
(2,917 Views)

log status is the command I want to send and that is 10 bytes but do I include an 11th byte for the \r character?

0 Kudos
Message 8 of 10
(2,910 Views)

I am now getting a response but it isn't what I want. Untitled2.pngI have now included the VI as well.

0 Kudos
Message 9 of 10
(2,906 Views)

Untitled2.png

I forgot I had the "End write on termination character" unchecked while I was testing it. Now I'm able to get output.

0 Kudos
Message 10 of 10
(2,899 Views)