Hi guys,
I am using C to implement a packet stream that will be sent out via wireless and am stuck at the following problem. I have an unsigned int 2 bytes long, in the following format in binary: XXXX YYYY XXXX XXXX, where X & Y's are bits.
Looking at the format above, I need to just changed the YYYY bits and leave the other bits alone in the packet structure.
I have tried bit shifting and masking, but nothing seems to work.
I am not looking for just a solution so I can copy/paste. I want to learn the methods on how to get it to work and finally decided to post here.
Any help or guidance in the correct direction would be great.
Thanks!