LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial communication with VISA

Solved!
Go to solution

I am trying to communcate with a Power supply via serial connection.  The communcation works great in Hyperterminal and PuTTY but i cannot seem to get it to work in labview.  It times out when I try to read the data.  

 

The hyperterminal settings are all basic and it works fine 

9600 baud rate

8 data bits

no parity

1 stop bit

no flow control

 

send "VOLT?" with CTRL+J for linefeed

retruns the voltage at the output of the UUT.

 

I am wondering if i am sending the command incorrectly in labview.  Any help would be great.  I have attached the VI, this is my first try at serial comms so it is pretty baisc and i am sure I am missing something

0 Kudos
Message 1 of 6
(3,030 Views)
Solution
Accepted by topic author Oneillp111

You aren't sending the linefeed.  You are only sending "Volt?"

 

Right click on the string constant, make the display style visible, and make it show \codes display.  Then enter \n at the end.  Now you'll be sending VOLT? with the linefeed.

 

Also, remove the shift regsiters off the reference and error wires.  (A single timeout error will keep your VI from executing again until you stop and restart the VI)

And put a VISA Close outside the loop.

 

Message 2 of 6
(3,022 Views)
Answering with mobile, so cannot look at your VI...

Did you use the linefeed string constant, when attaching a LF to your command?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 6
(3,020 Views)

Hi Oneillp,

 

To make sure that the program waits inbetween the read and the write put a flat sequence structure with the wait inbetween the visa functions. Like in the image I've attached. 

 

Also right click the string constant and select "'\' codes display" then you can send the new line command with the '\n' string. 

 

I've attached an image of the changes I made and the updated VI. Let me know if it works. 

 

Thanks 

 

Dan

 

 

Daniel Harryman MEng
CLA, CPI
Download All
0 Kudos
Message 4 of 6
(3,015 Views)

Thank you!! that worked

0 Kudos
Message 5 of 6
(3,007 Views)
Hi Dan,

you don't need the flat frame as the VisaRead will wait anyway! (TermChar is the keyword here!)
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 6
(2,982 Views)