Decoding Information from Sparkfun Can Shield

I´ve bought a Sparkfun Can-Shield some time ago and I´m trying to get some information from the Can bus (only read). I plugged it into the Car and got some information from the bus. I googled and found out that the information I want to get begins at Byte 5 and goes 10 Bit long. The Problem here is that the information I get is in HEX-Format and I have to split it to make it fit to the length. The information I get looks like this:

ID: 50B, Data: 19 8C 0 B4 94 13 0 A7

So for Byte 5 I have to start reading at 94 and then stop at the first 2 bit of 0. Now my question is how can I split the 0 so I can just get these 2 Bit and how can I decode the information after I get this. Here decode: 94 13 0?

Maybe there is a way to just get the binary information from the shield?

Thank you for the help!

All the data you receive is binary!!!!

It's only displayed as HEX as this is how your code is outputing the received data.

benipro:
I googled and found out that the information I want to get begins at Byte 5 and goes 10 Bit long.

please share the link or the whole information that explained how the data is supposedly represented.

btw if it 10 bits, I would expect it be across byte 5 and byte6 or byte 4 and byte5

benipro:
Here decode: 94 13 0?

that's 3 bytes!!!! ??

Look in the reference section here. There's a section towards the bottom called bitwise operators. You can extract and combine the bits you need with bitwise and, bitwise or and shift.

@sherzaad you are completely right, I made a mistake in my question. So the information is going across Byte 5 and 6 and therefore the information I think is: 13 0

To your answer about the binary stuff.
Do you know how I can get access to the bits so I can convert them to a decimal number ?
because I printed them out several times but I only receive these HEX numbers.

Thank you for the fast replys!

Btw. I´m using the code based on the tutorial from sparkfun. So I get a tCan-Message back.

benipro:
13 0

in the above, do you know which byte has the MSbit and LS bit?

I mean Byte 5 and 6 are 8 bit wide (so 16 bits in all)

so where is bit 0 and bit 9 located within those bytes for your data?

you did not supply that information!!!! (and I previously asked more info on that!)

The information starts with the MSB at beginning of the Byte 5 (at Bit 0) and ends after the first 2 of byte 6.

benipro:
The information starts with the MSB at beginning of the Byte 5 (at Bit 0) and ends after the first 2 of byte 6.

ok...

so in pseudocode something like this maybe:

union { 
    uint16_t val; 
    uint8_t bytes[2]
} data;
	
data.bytes[0] = Byte5 //lower byte
data.bytes[1] = Byte6 //upper byte
	
uint16_t myData = data.val & 0x03FF //0x03FF = 10 bit mask

I think your code could work but I don't quite get this line:

uint16_t myData = data.val & 0x03FF //0x03FF = 10 bit mask

Because in the definition it stands it would do something like:
e.g.
0110001000
0001001100
=>0000001000

data.val is a 16 bit variable

the mask basically set bits 10-15 to zero so that all you are left with is your 10 bit data.

That makes sense!

Thank you very much for your patience and the answers they helped a lot!