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 support@ccsinfo.com

ADC trouble with the PIC 16F873
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
hanckmann



Joined: 16 Apr 2004
Posts: 9

View user's profile Send private message Visit poster's website

OK
PostPosted: Fri May 07, 2004 5:16 am     Reply with quote

Ok, now I changes some other stuff (I am not yet shure what the problem was) and it DOES WORK !!!

I am now testing what the problem really was. I will add it in this post later.

Thanks for all your help

Best regards,

Patrick Very Happy
hanckmann



Joined: 16 Apr 2004
Posts: 9

View user's profile Send private message Visit poster's website

??????
PostPosted: Fri May 07, 2004 6:14 am     Reply with quote

Now I tried to find out what the real problem was. But i still do not have a clue....

This is the code I use now in the while(FOREVER) loop (see the source code listed before). I have enabled the interrupt now !!!!

Code:
while(FOREVER)
{

   Setup_Adc_Ports(RA0_RA1_RA3_ANALOG);
   Setup_Adc(ADC_CLOCK_DIV_8);
   Enable_Interrupts(INT_AD);

   SET_ADC_CHANNEL(0);
   delay_us(40);
   SetMux(0);
   adc1= READ_ADC();

   SET_ADC_CHANNEL(1);
   delay_us(40);
   SetMux(2);
   adc2= READ_ADC();

   lcd_clear();
   printf(lcd_putc,"X1: %ld\nX2: %ld", adc1, adc2);

   SETUP_PORT_A(NO_ANALOGS);
   Set_Tris_A (SETPORTA);

} // end of while(FOREVER)


Everything works now with the ADC, but if somebody has a clue about what was going wrng before I would like to know it !!!

Thanks again

Patrick Wink
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Fri May 07, 2004 6:42 am     Reply with quote

It was probably a combination of more than one problem: Wrong oscillator fuse setting, wrong ADC clock setting, using the wrong ADC channel,...
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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