17. Extract the Nibble from an 8-bit Register

Discussions5
Log in to post comments and replies.
You
Loading editor...
JohnEdison
JohnEdison
Jul 04 2026

Nibbles are just concepts, it doesn't exist within the programming language. So it doesn't matter whether you convert the values to hexadecimal or decimal. 

Hint: 
- If you successfully managed to create a flow for the lower nibble, just move the upper nibble. 
- Left shift (<<) function differently with Right shift (>>) as per the last challenges.

0
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
Jul 28 2026

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

+4
pratidnyakanse
pratidnyakanse
Jul 28 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)

+10