From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

serial connection to TPG252A pressure monitor

I am trying to get a reading from a pressure gauge that follows this communication scheme:
send: PR1
receive:
send:
receive: data
I haven't been able to get anything from either read signal besides a timeout error.
Is there any way to put a delay in between the send and receive steps? I had written a visual basic program that was successful in reading this instrument by simply giving a delay between the first and second send steps without receiving the confirm signal.
Any direction is appreciated.
0 Kudos
Message 1 of 4
(2,984 Views)
Wow, I don't think there's a single wire going the correct direction or a function in the right place;). Seriously, to make your diagrams more readable, read the style guide that comes with LabVIEW. Functions typically go left to right and wires the same way and don't cross. To directly answer your question, adding a delay is simply a matter of using the time delay function on the Time & Dialog palette. I've attached a cleaner version of your VI with it added after the first write. I'm a little unsure of your second write. You're appending a CR/LF with the first write but not the second? You might also want to use VISA Bytes at Serial Port to determine how many bytes to read instead of a fixed byte count.
Message 2 of 4
(2,983 Views)
Thanks a lot for the cleaner code 😃

I still haven't gotten this to work, but maybe you can help me answer a couple of questions:
1. When I do a write command to the serial port, does the message persist or is it just sent once? The communication specifications state that the device needs an Enquiry command, which is just a hex 05 with no CR or LF. I wonder if the device is receiving this command if it doesn't persist in the output.
2. Assuming the device responds with some arbitrary text that may or may not contain a termination character, will Labview still be able to read it?

Thanks again.
0 Kudos
Message 3 of 4
(2,965 Views)
You are not actually sending hex 05. What you are sending is the character "\" and then the character "5". The simplest way to do what you want is to right click on the string constant and select Hex Display. Then you can enter 05.

If your return strings will sometimes not a termination character, you should disable this setting in VISA Configure Serial Bytes. When this is enabled, the VISA Read will terminate when either byte count is read or the termination character is received. Without a termination character, instead of using a fixed byte count, its better to first use a VISA Bytes at Serial Port to determine exactly how many bytes are present and then wire the results to your byte count input of VISA Read. Putting a small delay before the VISA Bytes at Serial Port will aften be enough to ensure that you're got the entire instrument response before checking the available bytes. To get a little fancier, you could put VISA Bytes at Serial Port inside a while loop and exit when the byte count is greater than 0. Then do another while loop with VISA Bytes and the VISA Read. This while loop would then be terminated when the byte count is 0. I posted an example of this here if you want to take a look.
0 Kudos
Message 4 of 4
(2,960 Views)