|
|
View previous topic :: View next topic |
Author |
Message |
mjdale2003
Joined: 10 Oct 2004 Posts: 21 Location: UK
|
Analogue to digital12f683 |
Posted: Wed Feb 16, 2005 9:47 am |
|
|
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
|
|
Posted: Wed Feb 16, 2005 3:49 pm |
|
|
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 |
|
|
|
|
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
|