04-05-2012 05:36 AM
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.
Solved! Go to Solution.
04-05-2012 05:48 AM
Please post a snippet of your code where you are sending the data.
04-05-2012 05:52 AM
Sounds like it could be a timing issue, but as P Anand said post your code and we'll help you out
-CC
04-05-2012 06:21 AM
Here's the VI.
04-05-2012 06:28 AM
Hi,
Could you post the VI in 2010?
-CC
04-05-2012 06:44 AM
Hope I've done this correctly.
04-05-2012 07:03 AM - edited 04-05-2012 07:04 AM
Yep you did it right
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
04-05-2012 07:16 AM
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.
04-05-2012 07:28 AM
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
04-05-2012 07:32 AM
Thanks Guys for all your help.