10-12-2012 03:01 PM
Hi all,
I have a small application that consists of reading data from a serial port using VISA READ function. The source of data that i am trying to acquire from the serial port is a microcontroller that is sending a word or a byte( 8bits) . However, when trying to download the programming code into the microcontroller, the programming software saves the code as HEX file in the chip.
That was all just an explanation to get into the problem.
in oreder to get my application done, i used the attached VI which i did not program but added some functions to it for many purposes.The Vi is working perfectly and everything is working well, but it seems that i got some misunderstanding right here.
what i am trying to understand right here is why a (hexadecimal string to number) function is used as long as i configured everything to read bytes( 8bits)
I am very confused
any suggestions would be appreciated.
Thank you
Solved! Go to Solution.
10-12-2012 04:31 PM - edited 10-12-2012 04:33 PM
Hi Bill David,
you say your vi is working correctly.
you receive 1 or 2 bytes. and the a 'byte of information' could also be in hex format.
try the vi (LV2012) attached. if you are using some other version of labview let me know. instead of string datatype try with numeric or other datatypes also.
RENN
10-13-2012 08:21 AM
Thank you RENN
I am using labview 8.5 , could you please convert it so i can try your VI ? 🙂
Thank you
10-13-2012 08:37 AM
Dear RENN
i understand that the byte of information could also be in HEX but if you just take a closer look at the consumer loop you gonna find that the programmer of this VI has used the division function where he divided by 255 which represents the decimal representation of a byte (8 bit) 2 to the power 8= 256 so he divides by 255 .
i am very confused with that
Thank you
10-13-2012 08:40 AM
Converted to 8.5 and attached.
You could also use
http://zone.ni.com/reference/en-XX/help/371361H-01/glang/byte_array_to_string/
http://zone.ni.com/reference/en-XX/help/371361H-01/glang/string_to_byte_array/
to do the conversion.
10-13-2012 12:24 PM