kushalkoolwal
10-18-2004, 09:10 AM
Hi,
I have a peculiar problem. I want to store a 8-bit unsigned integer (like 2,4,6,8,10,12,14,etc) in packet of 1 byte. How can I do that? Also if I am able to store how can I read that byte agian?
I am giving a sample packet discription as below: How can store number like 2 or 10 in the message type.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|message type|
+-+-+-+-+-+-+-+
It would be great if someone can show me a small example.
Thank you
Kushal
I have a peculiar problem. I want to store a 8-bit unsigned integer (like 2,4,6,8,10,12,14,etc) in packet of 1 byte. How can I do that? Also if I am able to store how can I read that byte agian?
I am giving a sample packet discription as below: How can store number like 2 or 10 in the message type.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|message type|
+-+-+-+-+-+-+-+
It would be great if someone can show me a small example.
Thank you
Kushal