From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Read Missing Bytes

Solved!
Go to solution

Hello,

 

I need to read some telemetry from an equipment. The telemetry's lenght is exactly 113 bytes. It doesn't have start and end bytes, however the 2nd and 3rd byte is always "DD" and the last two bytes are a check error CRC of the other 111 bytes.

 

At the moment, using the VI I'm sending attached, I can read the telemetry but with some problems. Sometimes, it will not read from the correct 1st byte, which will cause a bad interpretation of the telemetry. And there are times that it does not read all the 113 bytes (it will read only between 86 ~ 109 bytes), which is also a big problem.

 

When these problems occur, it will often read correctly again on the next serial read. However, sometimes it takes a long time to read correctly and I can't afford this.

 

These problems are all random. During an hour it may have very few problems and then in 10 minutes it may have lots of consecutive serial read problems. I used other softwares to check the telemetry and they didn't have these problems. That means I'm not using correctly LabVIEW to read the serial or there is something I'm missing.

 

About the VI, I just want to read correctly the 113 bytes and use a queue to send the data to another while loop. When it doesn't read the 113 bytes or when the 2nd and 3rd bytes are not "DD" or when there is some problem on the serial, I "reset" the communication by closing it and opening it again.

 

Could anyone send suggestions and recommendations about my problem and my VI so I can hopefully solve this situation? Any help would be appreciated.

 

Thank you very much. Best regards,

 

William Kiyoji Ariyoshi (LabVIEW8.5)

0 Kudos
Message 1 of 5
(3,677 Views)
Solution
Accepted by topic author WKAriyoshi

Turn off the termination character.  That is done with the Configure Serial Port VI (there is a boolean on the top of the VI that needs a FALSE wired to it).  By default, the termination character is set to 0xA.  So if you have that character anywhere in your data stream, the VISA Read will stop there.

 

I also recommend moving the setup and closing of the serial port outside of your While loops.  You should only setup and close it once.  You also need to add a clean way to stop the outer While loop (aborting the VI is not a good idea, especially since you are using communication buses).


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
Message 2 of 5
(3,651 Views)

That makes lots of sense. I will try doing your suggestion and I will reply as soon as possible.

 

Thanks for your answer crossrulz!

0 Kudos
Message 3 of 5
(3,638 Views)

You are my hero, crossrulz! Now it is working without any errors. Thank you very much!

 

I was having this trouble for a long time and I never imagined that it would be this simple. I should read more carefully the help details. Thanks!

0 Kudos
Message 4 of 5
(3,601 Views)

As I keep telling my coworkers, learn from my mistakes.  I've personally ran into that issue, which just makes it easier to spot.


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 5 of 5
(3,586 Views)