LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sometimes bytes lost, when reading from serial port

Solved!
Go to solution

Are your responses terminated? If so, use the termination character to read the responses correctly. You have it enabled in your initialization but you may need to change the character that is being used as the termination character. Also, if you are sending multiple commands at one time that will generate multiple responses the "Bytes At Port" is not a good way to go. Since the device may send the responses one right after the other it is easy for your application to see x bytes available. This x bytes could be the complete first response and the partial second response. If you use the termination character correctly this shouldn't happen.

 

Also, you should look at using a the Format String VI to build your commands. The massive concatenate string is not a good way to go. It works, but it is much more difficult to modify if you have to insert something in the middle of the command.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 11 of 13
(1,470 Views)

Your VI is designed to only run once.  Initialize, Write, Wait, Read, Close.  You aren't using the Run Continuous button are you?

 

Normal serial port communication should initialize first before a while loop, Write, Wait Read in a while loop.  Only close the port after the while loop ends at the end of the program.

0 Kudos
Message 12 of 13
(1,456 Views)

hi

thank you all for your help i found the solution for my problem.... i was not terminating commands properly so that was the reason ...

thanks

best of luck

 

imran iqbal

0 Kudos
Message 13 of 13
(1,448 Views)