Mar 6, 2009 #1 D dsupriya Newbie level 1 Joined Mar 6, 2009 Messages 1 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,286 I have a 4 bit Hex number. The first 3 (starting from the LSB at right) bits give me the data and the 4th bit gives me the address. How do I read the data bits separately?
I have a 4 bit Hex number. The first 3 (starting from the LSB at right) bits give me the data and the 4th bit gives me the address. How do I read the data bits separately?
Mar 6, 2009 #2 M!k Advanced Member level 2 Joined Apr 22, 2002 Messages 681 Helped 109 Reputation 218 Reaction score 35 Trophy points 1,308 Activity points 4,823 easy in C: data = hexnumber & 0x07; // mask the lowest 3 bits your next question will be: "how do I read the address bit?": address = hexnumber >> 3; // shift the address bit to the lowest position, so address will be 0 or 1
easy in C: data = hexnumber & 0x07; // mask the lowest 3 bits your next question will be: "how do I read the address bit?": address = hexnumber >> 3; // shift the address bit to the lowest position, so address will be 0 or 1