10-02-2010 01:48 PM
How do I convert 32 bits of data to 16 bits and 16 bits?
Eg:-
My first input is 1000 in i16 format.
My 2nd input is 1000 in i16 format.
When i send this in CAN the the can data received from FPGA is in format of 32 bits.
i.e the value is coming as 3892570115
How do i convert the above number back to 1000 and 1000??
Input:-
Byte0=1000
Byte 1=1000
Output:-
3892570115
Convert the output(3892570115) back to input as mentioned above.i.e 1000 and 1000
Solved! Go to Solution.
10-05-2010 12:27 PM
Think in binary:
1000d = 0000 0011 1110 1000 Binary
3892570115 in an unsigned decimal, 32 bit = 1110 1000 0000 0011 1110 1000 0000 0011 binary
So I think the issue is with the endian format of the data, you need to swap the byte order of i16
10-06-2010 08:46 AM - edited 10-06-2010 08:47 AM
Here are some simple VI's that I use in my CAN communication. You can see the conversion from U32 to U8's and vice versa. The U16's are a step along the way. One of the VI's shows how to handle negative numbers. These are all in LabVIEW 9.0.1.
10-06-2010 11:01 PM
Thankyou so much..
The problem is resolved