Bilal
Joined: 24 Apr 2010 Posts: 75 Location: Islamabad
|
a/d problem |
Posted: Sun Oct 31, 2010 8:19 am |
|
|
hi.. i am using PIC16F877A.. i read its datasheet.. it says A/D gives 10 bit of data that is 0 t 1023 but when i use this code..
Code: |
#include <16F877A.h>
#use delay(clock=4000000)
#fuses HS,NOWDT,NOPROTECT,NOLVP
#include <lcd.c>
void main() {
int16 read;
lcd_init();
setup_port_A( ALL_ANALOG );
setup_adc( ADC_CLOCK_INTERNAL );
set_adc_channel(0);
do{
read = Read_ADC();
lcd_gotoxy(1,1);
printf(lcd_putc," %Lu ",read);
} while (TRUE);
}
|
LCD gives 0 to 255
please help _________________ ... |
|