06-22-2025 09:40 AM
Hi,
I am acquiring data through a serial port. I have to acquire 25 different data packets with different headers. 22 of the packets are 90 bytes each while the remaining 3 are 30 bytes each. For example:
Packet 1: $SM123........89 (header=$SM, total bytes = 90)
Packet 1: $FG123........89 (header=$FG, total bytes = 90)
.
.
Packet n: $XY123........89 (header=$XY, total bytes = 90)
Packet n+1: $YZ123........29 (header=$YZ, total bytes = 30)
I can acquire a data packet with the same header, but can't do with all the headers.
Solved! Go to Solution.
06-22-2025 11:37 AM
Hi Hameed,
@Hameed97 wrote:
I am acquiring data through a serial port. I have to acquire 25 different data packets with different headers. 22 of the packets are 90 bytes each while the remaining 3 are 30 bytes each.
Do those messages come with a (well-defined) TermChar?
Why not use that TermChar and request ALWAYS 100 bytes from VISARead?
When there is no TermChar: read just 3 bytes to receive the header ("$xy"), then read the number of bytes expected for that header…
Do you know this excellent video?
06-24-2025 11:46 AM
Hi,
I have to acquire different data packets with different data lengths and different header Bytes. For example,
packet 1: $HA123....89 (3 header bytes, total length: 90)
.
.
packet 15: $MN123....29 (3 header bytes, total length: 30)
...
packet 24: $YZ123....49 (3 header bytes, total length: 50)
How can I do this.
06-24-2025 01:59 PM
06-25-2025 12:23 AM
Hi GerdW,
There is no TermChar,
"When there is no TermChar: read just 3 bytes to receive the header ("$xy"), then read the number of bytes expected for that header…"
This simple solution worked very well.
The video you mentioned is also very useful.
Thanks
Best regards,
Hameed
06-25-2025 12:24 AM
HI GerdW,
Yes, you are right, I should have followed my thread instead of following an old thread.
Best regards,
Hameed