|
|
View previous topic :: View next topic |
Author |
Message |
remco Guest
|
trouble with pic 16f688 ADC |
Posted: Fri Sep 09, 2005 4:42 am |
|
|
Hello,
I use a pic16f688 for reading an analog channel and send it trough rs232.
Now the function READ_ADC seems to deliver only 8 bits. I like 10 bits
What goes wrong?
Can anyone help me?
Thanks
Remco
#include <16f688.h>
#device ADC=10
#fuses INTRC,NOWDT,NOPROTECT, NOMCLR
#use delay(clock=8000000)
#use rs232(baud=9600, bits=8, xmit=PIN_C1, rcv=PIN_C2)
void main() {
char string[30];
int16 value;
setup_adc_ports(PIN_A0 | VSS_VDD);
setup_adc( ADC_CLOCK_INTERNAL );
set_adc_channel(PIN_A0);
delay_ms( 10 );
while (TRUE)
{
printf("\r\nTik maar een woord in, bedenk maar wat:\n\r");
gets(string);
printf("\n\rhet door jou ingetikte woord was: %s", string);
value = Read_ADC();
printf("\n\rde meetwaarde is:%4x",value);
}
} |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Fri Sep 09, 2005 6:58 am |
|
|
Also quit posting in serveral threads.
This is wrong
Code: | set_adc_channel(PIN_A0); |
Read the manual to see how to use this function. |
|
|
|
|
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
|