01-07-2016 12:36 AM
Hello All,
I am a beginner in Labview and this is my first post on the forum.
I am receiving a serial packet "1200F" on the COM port from an MCU. These are all ASCII characters.
I want to convert all these ASCII characters to decimal numbers and add up their decimal values to get the sum. So I have taken the ASCII string into an array using "String to Byte Array" and then type cast this using constant type U8. I have put this in for loop and collecting the decimal value using Build Array function. Then I am "Add array elements" function to add these decimal values to get the sum.
The problem is that for input string I am able to get sum of "1200" only. The moment I type the last ASCII character F, the sum goes wrong. I see that when the sum goes above 255 it again resets from 0 onwards. I have attached the VI for reference.
Any help would be appreciated.
Solved! Go to Solution.
01-07-2016 12:55 AM
hi
you can change your dispaly numeric data type.
01-07-2016 12:55 AM - edited 01-07-2016 12:56 AM
Convert to U32 to avoid the 255 limitation of U8.
01-07-2016 02:53 AM
Thanks JB, this works and more simpler than I was thinking.