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

trouble with pic 16f688 ADC

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







trouble with pic 16f688 ADC
PostPosted: Fri Sep 09, 2005 4:42 am     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Sep 09, 2005 5:19 am     Reply with quote

see response http://www.ccsinfo.com/forum/viewtopic.php?t=21954
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Fri Sep 09, 2005 6:58 am     Reply with quote

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.
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