10-09-2019 12:49 AM - edited 10-09-2019 12:49 AM
Hi mabaig,
but I am forming 32 bit Boolean array from different numbers. That's why only needed 4 bits from some numbers.
Then why do you need boolean arrays at all?
All you need are I32 values and some AND and SHIFT operations…
(You would have got that answer much earlier if you would have told the purpose of this exercise from the beginning!)
10-09-2019 09:59 AM
@mabaig wrote:
I am forming 32 bit Boolean array from different numbers. That's why only needed 4 bits from some numbers.
You can use AND with 1, 2, 4 and 8 to get your needed bits, i bet it's easier. 🙂
/Y
10-10-2019 01:26 AM
i needed to manipulate 32 bits word from hex number so converting this hex number to 32 bit Boolean array.
Can you please send a screenshot what you told ( I32 valuese with AND and SHIFT operations)
thanks and regards
baig
10-10-2019 01:39 AM
10-10-2019 02:56 AM
for example:
"1B1222AC" is a hex number. This hex number is to be decoded into 32 bits and is to be manipulated [1B(last 8 bits) is a checksum 1(1st decimal) 2 (2nd decimal) 2 (3rd decimal) 2 (4th 1/100th %f,decimal) of a intiger(here its 122.2 d) to be displayed and AC is start of word indication]
this 1222 are 4 bit each from the hex number and to change it i needed Boolean array of 4 bits for each digit. later after changing like and manipulating to indicate(suppose 118.2) , again I needed to convert this 32 bit boolean array to hex number as 1B1182AC.
I did this operation but since i lack skills in labview I had to use number to string and then string in forloop to get array of each digit in string then again string to number and again index array to get each digit desperately and then again that digit will be a boolean of 8 bits but i need 4 bits then again array subset i used. I know this is kinda stupid way of doing that stuff. And that's why I am here :D.
Thanks and Regards
Baig
10-10-2019 04:49 AM
Hi Baig,
@mabaig wrote:
"1B1222AC" is a hex number. This hex number is to be decoded into 32 bits and is to be manipulated [1B(last 8 bits) is a checksum 1(1st decimal) 2 (2nd decimal) 2 (3rd decimal) 2 (4th 1/100th %f,decimal) of a intiger(here its 122.2 d) to be displayed and AC is start of word indication]
this 1222 are 4 bit each from the hex number and to change it i needed Boolean array of 4 bits for each digit. later after changing like and manipulating to indicate(suppose 118.2) , again I needed to convert this 32 bit boolean array to hex number as 1B1182AC.
Like this:
It's all about bit masking and shifting…
10-11-2019 12:46 AM
thats cool. Thanks alot.
can we do the same to merge normal display numbers? since its a hex its works fine but to merge integer 4 and integer 5 to give 45 in normal display(not hex)?
Thanks and Regards
10-11-2019 12:57 AM
Hi Baig,
@mabaig wrote:
can we do the same to merge normal display numbers? since its a hex its works fine but to merge integer 4 and integer 5 to give 45 in normal display(not hex)?
Why do it this complicated? Why not use these options:
10-11-2019 01:43 AM
Hi GredW
I have did the same with format into string option but wanted to simply a little (because I have 32 hex words to do and not all are decimal indicators but string, boolean and combobox) ':). Yeah you are right I might be making simple things complicated (just becoz i need to manipulate at bit level).
Thanks alot. Ill try simple maths and will get to you . 🙂
Thanks and Regards
Baig