Hi Gang

I am trying to extract serial number from a RFID bracelet using a Wiegand Interface. I have read that I need to use a combination of bit manipulation and masks. I have been able to get my head around bit manipulation but I’m having trouble with masks.

If for example I have the following raw code;

1 0110 1101 0101 1000 0011 1111 0

And I want to remove the right most bit, I simply use bit manipulation;

rawCode >> 1

This moves all bits one step to the right leaving me with;

1 0110 1101 0101 1000 0011 1111

If however I’m only interested in the remaining last 24 bits then I believe I need to use a mask;

0xFFFFFF

Specifically I need to combine bit manipulation and mask to extract the serial number;

serialNumber = (rawCode >> 1) & 0xFFFFFF

I don’t understand the syntax for the mask;

0xFFFFFF

The ‘F’ I assume is a hexadecimal, therefore FFFFFF represents 24 bits. I don’t get the 0x???

Can someone possibly explain?

Cheers

Jase