LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

rs232 read and write from pressure transducer with command.

New to LabVIEW and have my first task. I have connected to a Setra pressure transducer via rs232 in Com port 4. I'm trying to track and log pressure over a given period of time. A command of "P" must be sent to the transducer for it to return a pressure reading. By searching, so far I have VISA open, close, read and write on my block diagram. I tried to create a constant from the VISA read resource name and connect it to COM4, but that did not work. Not sure how to accomplish my goal or how to wire everything up correctly. Any help for a beginner is appreciated.

0 Kudos
Message 1 of 11
(3,043 Views)

Use the example finder (Help->Find Examples...) and search for something along the lines of "simple serial communication".  There is a good example in there.


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 11
(3,042 Views)

I get Error -1073807246 at the VISA configure serial port. It tells me the resource is valid, but the VISA cannot currently access it. Is this because I have not sent a "P" command to the device?

0 Kudos
Message 3 of 11
(3,040 Views)
0 Kudos
Message 4 of 11
(3,038 Views)

That error is due to some process already having exclusive rights to the port.  Do you have Hyperterminal or something else the could be using the COM port open?  Did you not close out the VISA reference during previous runs?


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
Message 5 of 11
(3,035 Views)

You were correct! I had forgotten to close digiquartz, which I used to test my connection. Now I can communicate with the transducer, just trying to get it to give me a pressure reading. I'll be back!

0 Kudos
Message 6 of 11
(3,020 Views)

NI Trace I/O is super useful for seeing when the port is opened and used, etc... Should be installed with your labview already.  Might be called NI Spy if you haven't updated in a while.  

0 Kudos
Message 7 of 11
(3,014 Views)

So, I can write command "P" and it produces a pressure. Great! Thanks for the help guys. Now I need to get it to monitor pressure and take a reading every x minutes (probably every minute) and graph/log the data. Is this best accomplished by using a loop and a datalogger with maybe a waveform graph?

 

I have converted the string ( +94.506    PSI A OK) to a number using the "fract/exp string to number" function. So now I have the format I need, I just need it every (insert time period).

 

0 Kudos
Message 8 of 11
(3,009 Views)

Yup, just send your P command every minute in a while loop.  Make sure only the read and write are in the loop though, setup functions are outside the loop.

0 Kudos
Message 9 of 11
(3,006 Views)

Just to clearify, the Initializing and Closing of the port should be done outside of the loop.  You can write and read inside of the loop as much as you want.


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 10 of 11
(3,000 Views)