Hi all!
Thanks a lot for your help.
@aarg: What I doing it reading CAN-Bus Data from a Car. I get 8 * 8Bytes of Data, saved in an Array "rx_frame.dada.u8"
So in total, I receive 64 Bits of information.
These Bits could represent the state of 64 actuators in terms of "on/off --> 0/1.
Usually though the 64Bits represent measurement Values of some sort. So, for instance we could receive a message :
HEX: A7 03 B4 9D 00 BB 07 7D
This would be in BIN
10100111 00000011 10110100 10011101 00000000 10111011 00000111 01111101
Now lets suspect there are 2 known signals in this message.
- 1 is an On/Off state
- 1 represents the speed of the car
The CAN Database could say:
Signal 1: Startbit 0, Length 1
Signal 2: Startbit 11, Length 9
For Signal1 I would need to take the first Digit of the Binary - pretty simple.
For Signal2 I would need to take "000011 10110", and convert this to a Decimal Number, multiply with a Faktor and Offset it. If there was no Faktor or Offset the correlating DEC would be 118.
So, for what I see I have to accomplish the following tasks:
- Take all the Data of the Array "rx_frame.dada.u8" and put it together in one variable.
- I need to somehow sort out the Bits I need (--> Bitshifting?) into a separate variable
- Convert the picked out bits to a decimal value.
- Faktor and Offset the value.
3 and 4 is clear - 1/2 not yet.
Hope I could explain what I am trying to do...
Very thankful for any input!