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

Analogue to digital12f683

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



Joined: 10 Oct 2004
Posts: 21
Location: UK

View user's profile Send private message Yahoo Messenger MSN Messenger

Analogue to digital12f683
PostPosted: Wed Feb 16, 2005 9:47 am     Reply with quote

Please could any one give me some code that works , for takeing an a to d reading on port pin GP2 of a 12f683 and storing the value in a variable without using the ccs functions as i am haveing some serious problems with it
Ttelmah
Guest







PostPosted: Wed Feb 16, 2005 3:49 pm     Reply with quote

Code:

#bit GODONE = 0x1F.1
#byte ADRESH = 0x1E
#byte ADRESL = 0x9E
int16 result;

GODONE=1;
while (GODONE) ;
result=make16(ADRESH,ADRESL);


The most likely problem is not with the read_adc function, which is very simple, but with the setup of the chip itself. You don't say how you want to configure it (clock source/rate, where Vref is to come from, etc. etc..). You need to work out what should be in the configuration registers for the ADC, the comparator, timer0, and the CCP and ensure these are all set correctly. The sheer number of peripherals multiplexd on some of the pins, makes this the hardest thing....

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