Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Get the first 3 bits of a 4bit Hex number

Status
Not open for further replies.

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?
 

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
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top