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

I can't turn on the ADC of 30F5015

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



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

I can't turn on the ADC of 30F5015
PostPosted: Thu May 23, 2013 2:57 am     Reply with quote

Hi! I can't take any reading from the ADC modul of 30F5015. Here is my program:
Code:

#include <30F5015.h>
#device ADC=12
#FUSES HS2_PLL8,NOWDT
#use delay(clock=80M)

void main()
{
   setup_adc_ports( sAN0 );
   setup_adc(ADC_CLOCK);
   set_adc_channel( 0 );
   int value=0;
   while(1)
   {
      value=read_adc();
      delay_ms(100);
   }
}



I have around 2.5V on PIN B0(AN0) and PIN B1(AN1).
When I turn on the program it's running but always value=0. I tried with ADC_CLOCK_INTERNAL - no change.
What am I missing?
Thanks!
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Thu May 23, 2013 7:51 am     Reply with quote

ADC_CLOCK, requires you to feed in an external clock for the ADC.....

ADC_CLOCK_INTERNAL should work though.

Questions:
1) What compiler version?.
2) How are you running this?.

There is no printout, so it suggests a debugger. Not all debuggers can simulate the ADC.

Best Wishes
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Thu May 23, 2013 8:22 am     Reply with quote

I`m using v4.134. It`s not a simulation. I have a pcb with 30F5015. I have 20MHz quartz. The controller is running correctly - I`m generating PWM signals with it. I`m using Pic Kit 3 as debugger and I`m watching the value variable int the watch window.

Best regards!
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Thu May 23, 2013 9:08 am     Reply with quote

There are _several_ 'limitations' in the release notes for the PicKit3, regarding certain PIC30's, and the ADC.

Try the code for real. Setup a serial output, print the value to this, and see what happens without the debugger.

Best Wishes
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