LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bytes at Port is zero after VISA Write

I am trying to connect mahr millitron with VISA Serial, but in my code, I get zero at "bytes at port". On the other hand, when I run "Simple Serial" example in Labview, firstly Labview runs E4 error later it works perfectly. Also, my code ran sometimes perfectly. Why is my code not working?
Download All
0 Kudos
Message 1 of 3
(940 Views)

Bytes at port is no good. Waits are no good.

 

Use the end termination character. Use serial init to set the end termination character, and you'll get a robust interface... Pretty sure the device sends termination characters, as you attach a \n to your message.

 

Why isn't your code working? Probably you have to use a longer wait... How long? Who knows... That's why waits are no good. You'll have to consider the longest wait, and add a margin. Even if the data is ready 99% of the time...

 

Why does the simple serial work, but not the first time? Probably because the first time there is no data (needs a longer wait) and the next iteration, you're reading the result of the first iteration.

0 Kudos
Message 2 of 3
(902 Views)
0 Kudos
Message 3 of 3
(892 Views)