[Moved] 12 to 9 bits ADC Bit masking...

Status
Not open for further replies.

steven2410

Newbie level 3
Joined
May 16, 2014
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
31

Microcontroller: MSP430 (https://www.glitovsky.com/Tutorialv0_3.pdf)
I'M NEW TO MICROCONTROLLER AND STUCK ON THIS PROBLEM FOR AWHILE. Along the way, i know how to bit masking using OR/AND operation. But i have no idea how to convert 12 bit ADC to 9 bit ADC through masking ( as the questions asked) and how masking help to remove the noise as stated.
Appreciate any guidance or learning sources.
 

hello,

if you have a 12bit value stored into an 16bits integer ( or 2 bytes collapsed)
and want to transform it into 9 bits value ... allways inside an 16 bits integer !

you have to do a register right shifts
like
Value9bit= Value12bits >> 3 ;
= XXXX 1011 0100 1000 -> XXXX XXX1 0110 1001
but you only loose LSB bits...

and With a AND mask you loose MSB bit
Value9bits = Value16bits & b'0000 0001 1111 1111'
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…