A/D 10 bit to 8 bit

Status
Not open for further replies.

AZdave

New Member
I have a analog input to a 16F877A, RA0 (AN0). The A/D result is stored as 10 bits - ADRESH (BANK0) and ADRESL (BANK1). I have the A/D result left justified, i.e. 8 bits of ADRESH + bits 7:6 of ADRESL. What I need is an 8 bit number (0-255) to send serially to a graphic LCD.

Will need to use the 6 least significant bits of ADRESH and combine them with the 2 most significant bits of ADRESL to get an 8 bit number? or will the 8 bits of ADRESH be the correct 8 bits?
 
As long as you have the result left justified (ADFM cleared), then you get the 8 bit result in ADRESH - no other action required.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…