LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

bitwise operation fragment

Solved!
Go to solution

Hi, 

I have the following piece of code that I have to implement in LABVIEW 

 

CRC_REG = CRC_REG * 2;      // one bit left shift

IF (CRC_REG >= 0x1000)      // achieving 12bit restriction
      CRC_ REG = CRC_REG - 0x1000 + 1

 

where CRC_REG is a 16-Bit-Register. On the attached pic is my implementation where CRC_REG is simply a control variable.

 Since I am not getting a different values from the ones that I am supposed to get, it would be nice if someone can take a look.

 

Thanks,

Iliya 

0 Kudos
Message 1 of 23
(3,995 Views)
I reaalized my error but I am not sure how to fix it. When I am using the Number to Boolean Array in the beginning it converts the number to 32 bit register even thought it is not needed and the number of bits should be 16. Is there a way to restrict this VI to convert the number to 16 bit array of booleans.
0 Kudos
Message 2 of 23
(3,990 Views)

The hex string to number function you use has a "default" input. Wire a U16 constant there to define the representation of the output value.

 

Do you really need to convert the value so many times between string and number? Why not work with a number all the way (you can display it in hex representation on the front panel)?

 

Message Edited by dan_u on 08-20-2009 10:20 AM
0 Kudos
Message 3 of 23
(3,985 Views)

Hi,

 

thx for the reply. U mean just to connect U16 constant no matter what its value is? 

0 Kudos
Message 4 of 23
(3,977 Views)

Yes. The value only matters if the conversion fails, then the output will have the default value.

 

0 Kudos
Message 5 of 23
(3,975 Views)
ok, I will try and let u know, but as I said before what troubles me as well is that after using the number to Boolean array function, I am getting an array of 32 bits always no matter what the number is, which can cause trouble when I do the left shifting operation. Am I right?
0 Kudos
Message 6 of 23
(3,973 Views)
didn't change the situation. Still getting wrong value...
0 Kudos
Message 7 of 23
(3,970 Views)

I don't see a number to boolean array in your code fragment.

But when you use a U16 input to this function it will return a boolean array of size 16.

 

Message Edited by dan_u on 08-20-2009 10:30 AM
0 Kudos
Message 8 of 23
(3,967 Views)
Here is the code I am implementing and the VI(a little bit unordered), where I am using the number to bin array routine.
Download All
0 Kudos
Message 9 of 23
(3,961 Views)

Wow, this code is really hard to read. Way too many locals and sequence structures... Any way too many conversions between strings and numbers.

 

0 Kudos
Message 10 of 23
(3,937 Views)