Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

8-bit adc from pic18f452 using mikroc compiler

Status
Not open for further replies.

ali shaheen

Junior Member level 1
Joined
Aug 29, 2010
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
pakistan, karachi
Activity points
1,419
Hello

i am taking an analog input from ra1 and after the input is digitalized it give 10 bit digital data but i want only 8-bit data so that each voltage level is sampled 255 times not 1023 times....

Please help.....

Regards
ali shaheen
 

PIC A/D converters are implementing sucessive approximation, not sampling the data 1023 (better 1024) times. But if you consult the datasheet, you'll see, that setting control bit ADFM=0 places the ADC result left justified in the ADRESx register pair. So ADRESH holds an 8 Bit value, as required.
 

Result of A/D conversion is stored in ADRESH and ADRESL registers. To read 8-bit value of conversion you need to align data to the left and then read ADRESH register. Also you can discard 2 most significant bits from 10-bit result of conversion.
You have example 'ADC on Leds' in MikroC compiler folder.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top