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

16F676 A/D not work!

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



Joined: 21 Oct 2004
Posts: 9

View user's profile Send private message

16F676 A/D not work!
PostPosted: Tue Jan 18, 2005 3:17 am     Reply with quote

Hi, techies,

I am using 16F676 in my project. AN4 to AN7 need to be set to A/D.
Here is my code:

void init_adc(void)
{
SETUP_ADC_PORTS(sAN4|sAN5|sAN6|sAN7|VSS_VDD); // AN4:7 A/D. others digital,range 0-vdd ??
setup_adc( ADC_CLOCK_INTERNAL ); //internal 2-6us
set_adc_channel(TRIM); //channel 5
SETUP_COMPARATOR(NC_NC_NC_NC); // off comparators

}

The problem is that the resistance of all this pin is only 22ohm instead of high impedance as normal ADC. It results input analog signal pull down.
I check register: ANSEL=F0, ADCON0=15,ADCON1=30. they are correct.
(Internal oscillator is used)

Please help

Cindy Confused
_________________
CC
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

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

PostPosted: Tue Jan 18, 2005 9:00 am     Reply with quote

Look at the LST file. Is something occuring after your setup routine to alter the ADC configuration?

Can you post a complete program (main() and the minimum of commands to demonstrate the problem)?

And it is always a good idea to post the version number of the compiler you are using. PCM Programmer and a few others here keep pretty detailed lists of known bugs and in what version they appeared and were fixed.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
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