CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

a/d problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Bilal



Joined: 24 Apr 2010
Posts: 75
Location: Islamabad

View user's profile Send private message Send e-mail

a/d problem
PostPosted: Sun Oct 31, 2010 8:19 am     Reply with quote

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
_________________
...
Ttelmah



Joined: 11 Mar 2010
Posts: 19550

View user's profile Send private message

PostPosted: Sun Oct 31, 2010 9:28 am     Reply with quote

#device ADC=10

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group