View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jan 20, 2009 2:35 pm |
|
|
Try a simple test program like this (get rid of most of your code) and see
if it works. If it doesn't work, then post:
1. Your compiler version.
2. A description of the circuit connected to AN12 (pin B0).
Here's the test program:
Code: | #include <16F767.h>
#device adc=10
#fuses INTRC_IO, NOWDT, BROWNOUT, PUT
#use delay(clock=8000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
//========================
void main()
{
int16 adc_value;
setup_adc_ports(ALL_ANALOG);
setup_adc(ADC_CLOCK_DIV_16);
set_adc_channel(12);
delay_us(20);
while(1)
{
adc_value = read_adc();
printf("%LU ", adc_value);
delay_ms(500);
}
} |
|
|
|
robyvelez
Joined: 08 Dec 2008 Posts: 2
|
FIXED! (I think/hope) |
Posted: Tue Jan 20, 2009 8:13 pm |
|
|
Thanks a lot for the reply. I tried the sample code you presented, but that still didn't work, and then I got to thinking about the compiler version.
I tried using a computer with a more updated version of the compiler. I'm an engineering student at a college and the computer I've claimed to use for my project had an old version of PIC C. Using a new version of the compiler the program seems to works fine. I'm going to ask ITS to update the version of PIC C on this computer and try it tomorrow, but I think using a more up to date compiler will do it. If not I'm sure you'll hear back from me again. |
|
|
Guest
|
|
Posted: Sat Jan 24, 2009 7:39 am |
|
|
Hi
Remove the line setup_spi(false); this it not right.
Its the same as setup_spi(0) which is:
#define SPI_CLK_DIV_4 0
:-) |
|
|
|