LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial write problem

Solved!
Go to solution

Hi, I'm having problems writing to serial. If I run in debug (highlight execution) mode it appears to write OK, but once out of debug it will only work occasionally or if I send something to my VI for it to read first.

 

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

Please post a snippet of your code where you are sending the data.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 11
(3,274 Views)

Sounds like it could be a timing issue, but as P Anand said post your code and we'll help you out

 

-CC 

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Message 3 of 11
(3,271 Views)

Here's the VI.

0 Kudos
Message 4 of 11
(3,260 Views)

Hi,

 

Could you post the VI in 2010?

 

-CC 

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Message 5 of 11
(3,255 Views)

Hope I've done this correctly.

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

Yep you did it right Smiley Very Happy

 

Your program looks good (although a single case structure with an enum selector might be a better fit for selecting which command to send).

 

I would try and put a delay (maybe 50ms to start with) between the write and read VIs. 

 

 

See if that helps.

 

-CC 

 

 

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Message 7 of 11
(3,238 Views)
Solution
Accepted by NewWorldMan

No I don't think its the right way. You are trying to read from the serial port and the same resourse you are passing to the write so if you don't have any data to read you will get an error in sequence your write serial port will not work/through error. So you have to check whether any data is available at the serial port before reading.

 

Its just an example I have attached you can do that better.

 

Good luck.

 

 

-----

The best solution is the one you find it by yourself
Message 8 of 11
(3,231 Views)

I cant open the VI here, but a common problem is to not have any wait between write and read in the VISA communication. Put a 100ms in between to give the serial port time to talk and recieve a result.

 

It's about the only instance where a sequence frame is a good solution. 😄

 

/Y 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 11
(3,225 Views)

Thanks Guys for all your help.

0 Kudos
Message 10 of 11
(3,220 Views)