01-21-2014 11:47 AM
Hi I have an array of u32 numbers (all 0 or 1) and I would like to convert them to 1,0s and hex value. could you please let me know how can I do it?
For example array of "0" "0" "0" "1" "0" "0" "0" "0" should give me 00010000 and 10(hex)
Thanks
01-21-2014 12:53 PM - edited 01-21-2014 12:56 PM
Lots of ways come to mind. To start with though, Why is your data coming in as a u32 array? Seems like a strange data format for 0s and 1s.
Scan into string with a loop is one way.
You can also do this bitwise by OR'ing in your inputs and using bit shifts.
You may just need to set the display mode of your indicators after you do the number assembly unless you actually need a string.
EDIT: Another messy way to do this would be to do comparisons to create a Boolean array and then do the Boolean Array to Number.
01-21-2014 01:02 PM