Thread: Nybbles

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    5

    Question Nybbles

    How do I separate the high and low nybbles in a 8 bit binary number?

  2. #2
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    For the low one, you just need to and it
    with 0x0f. For the high one you just need to
    and it with 0xf0 and then shift it to the right by 4.

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    412
    FYI, the code for what Nick said is:

    lowNybb = byte & 0x0F;
    highNibb = (byte & 0xF0) >> 4;

Popular pages Recent additions subscribe to a feed