17. Extract the Nibble from an 8-bit Register

Discussions4
Log in to post comments and replies.
You
Loading editor...
AshwinGaykar
AshwinGaykar
Jun 12 2026

done

0
78rsingh87
78rsingh87
Jun 09 2026

Should the upper nibble be anded with 0x0F per the solution?

 

0
KimSnV
KimSnV
May 27 2026

I have a better solution for this problem 
reg = (reg  >> (pos * 4)) & 0x0F

0
RohitTelkar
RohitTelkar
Mar 12 2026

Can someone explain what a nibble is? I am new here.

+3
pratidnyakanse
pratidnyakanse
Apr 21 2026

Hello Rohit, 

Nibble is a group of 4 bits. Since each bit can be 0 or 1, a nibble can represent 16 values (from 0000 to 1111 in binary), which is equal to 0 to 15 in decimal or 0 to F in hexadecimal.

Example :

Decimal  is 25, then the binary of 25 is 00011001 then the nibbles are as follows
Nibbles : High = 0001 (1), Low = 1001 (9)

+7