Using adc in pic18f452

Status
Not open for further replies.

Barasha

Member level 2
Joined
Nov 15, 2011
Messages
49
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Guwahati ,India
Visit site
Activity points
1,579
Hello,

I am a beginner in mikroC. Need some explanation regarding 0x80 in the line shown below that are used in programs.

ADCON1 = 0x80; // Use AN0 and Vref=+5V
 

Read the datasheet ADC Section. ADCON1 is the register used to set which PORT pins to be used as analog input pins, in some uC to set Vref +/- voltages and to left or righ justify the ADC result. If ADCON1 is 0x80 then the 8th (0 to 7) bit (MSB) od ADCON1 is set which will be usually for left justify the ADC result which appears in ADRESH and ADRESL registers.
 
Hi salmanliaquat and jayanth.devarayanadurga

Thanks for the reply. Have seen the datasheet but still have a doubt about the data stored in ADRESH and ADRESL registers. Will the data stored be the digital value of the analog input.
 

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…