Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Communication in NI Max but not LabVIEW VI

I am able to communicate to a device in NI Max very easily. I set the baud rate and I remove all uses of the terminal character, then I can easily write to the device using the command "current=200\r". I tried to do this using VISA Configure Serial Port with the terminal character disabled. I use the same command and it doesn't work. I also tried enabling the termination character and changing it to 13 (to represent \r) and using the command "current=200" and that hasn't worked either. 

sabolton_1-1648589433589.png

 

sabolton_0-1648589383610.png

 

0 Kudos
Message 1 of 5
(1,826 Views)

You have to give the port time to send the data.  You are currently passing the command to the port's buffer and then immediately closing 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 2 of 5
(1,808 Views)

Thank you for the suggestion, unfortunately that didn't work. I added a time delay of 3 seconds and I tried removing VISA Close completely. 

0 Kudos
Message 3 of 5
(1,777 Views)

If you put the 3 second wait in the simple VI, it won't necessarily wait when you need it.  Try putting the steps in a flat sequence structure, with the VISA initialization in one frame, the send in the second frame, the wait in the 3rd frame and the VISA close in the last frame.  3 seconds is too long.  500 ms is suitable.  Also, why are you not using the default termination character?

0 Kudos
Message 4 of 5
(1,730 Views)

You could start with this example from NI :

 

Serial example.png

0 Kudos
Message 5 of 5
(1,714 Views)