LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hexadecimal Reading does not match the reading of RealTerm Serial Capture


SERDARSOYLU wrote:
here is the picture

Your picture isn't showing very much.  It shows how you are acquiring some variable number of bytes, but not showing any more of how you are handling them and passing them on.

 

The bytes at port method of reading the serial port can lead to a lot of problems.  Every 100 milliseconds, you read whatever has arrived at the port.  That could be any number of bytes.  If you received 39 bytes, but should have received 40 to make up 10 4-byte data packages, now you have a problem.  You can convert 9 of them, but the 10th one is missing its final byte and will be invalid.

 

Your data handling would need to account for that.  And if on your next read, you get that 4th byte, then some bytes after that,  your data packages will all be framed wrong and all the data will be wrong as it will interpret the next piece of data as byte 4 (previous data) then bytes 1, 2, 3 (of the next data).   Then byte 4 of that next data with bytes 1,2,3 of the next data after that.

 

Unless you are handling these issues elsewhere in your code that is not shown, you are going to have problems with the bytes at port method.

0 Kudos
Message 11 of 14
(1,104 Views)

I'll jump in too,

 

So, from what I've read, when you display an ASCII char as a string in LabVIEW you miss some chars.....  What font are you choosing?  Are those ASCII chars defined in the font?  

 

Google "Bable map" and please, understand that not all 0xHHHH CHARs can be displayed in all fonts


"Should be" isn't "Is" -Jay
0 Kudos
Message 12 of 14
(1,095 Views)

Thank you very much for responses. if bytes at port method is bad what would be the best way to parse serial data? For instance, in my application, data assemble is in the following form:

 

header 1:0x8011 followed by  1 data word for checksum, 1 data word(each data word 16bits),

 header 2:0x8012 followed by 1 data word for checksum, 28 data word (each data word 16bits),

 header 3:0x7FFF followed by 1 data word for checksum, 9 data word(each data word 16bits),

where checksum is defined as  a 2s-complement of the 16-bit sum of the rest of the entire message.

 

My question is how can I process this data so that I can process one data ensemble at a time without missing any data assemble sent by my serial device through VISA? Also, this structure is dynamic meaning Header1 and its associated data words i sent once at the startup. Could you please let me know how to do this?

Thank you! 

0 Kudos
Message 13 of 14
(1,068 Views)

Hi Serdarsoylu,

Yes, use VISA commands and then convert the data from hex to string. Then you can interpretate the data.

 

FLash

National Instruments
Applications Engineer
0 Kudos
Message 14 of 14
(1,054 Views)