Hi I am very new at PIC programming and am becoming very frustrated.
Can anyone help me set up an Analog to Digital Conversion? I have a Picdem 2 Plus demo board and would like to program the POT on RA0 to read the input and output the value in a digital fashion.
I have set #device ADC=10 in the C file just after #include<16F877A.h>
#use standard_io(D)
int 16 a, b, c, d, e;
int 16 value;
WHILE(1){
a = 205;
b = 410;
c = 615;
d = 820;
e = 1024;
set_adc_channel(0);
delay_us(20);
value = READ_ADC();
..........
Then there are several IF statements so that LEDs can be lit up accordingly. Obviously alot of code is missing but I tried to include only the important ADC portions of the code. If anyone can tell me where I am going wrong or what I am missing I would sure be thankfull.
Thanks again, Abe
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
Posted: Sat Dec 23, 2006 5:32 pm
I don't see an obvious error in your program. You didn't give a complete program, neither did you tell us what isn't working so right now we can't help you any further.
Give us a small but complete program to test (and then please use the 'code' buttons for preserving the code layout).
Or you might have give the program ex_admm.c in the picc/example directory a try to see if that is working.
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Sat Dec 23, 2006 6:36 pm
Quote:
I have a Picdem 2 Plus demo board and would like to program the POT
on RA0 to read the input and output the value in a digital fashion.
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