18. Set Multiple Bits in 8-bit Register

Discussions2
Log in to post comments and replies.
PhoenixDale
PhoenixDale
Oct 26 2026

uint8_t len = end - start + 1;

    uint8_t mask = ((1U << len) - 1) << start;


 

    return reg | mask;
if you do this it gets you the right idea

+1
ShekharYadav
ShekharYadav
May 21 2026

i m not able to understand

 

0