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

Internal Oscillator 12F615

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



Joined: 16 Aug 2013
Posts: 2

View user's profile Send private message

Internal Oscillator 12F615
PostPosted: Sun Aug 18, 2013 11:13 pm     Reply with quote

Good day,

I am new with the software and a student. Embarassed I need some advice on the setup of the internal oscillator. How do I know if the internal oscillator are running when using the PIC12F615? I have done the setup, but it seems that my processor is not running.

See my code:
Code:

#include <12F615.h>
#device adc=10

#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOPROTECT //Code not protected from reading
#FUSES IOSC8 //INTOSC speed 8 MHz
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOPUT //No Power Up Timer

#use delay(clock=8000000)

void main()
{
setup_adc_ports(sAN3|VSS_Vref);
setup_adc(ADC_CLOCK_INTERNAL);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DIV_BY_16,255,1);
setup_comparator(NC_NC_NC_NC);

Hope somebody can assist me.

Billy.
stinky



Joined: 05 Mar 2012
Posts: 99
Location: Central Illinois

View user's profile Send private message

PostPosted: Sun Aug 18, 2013 11:46 pm     Reply with quote

How do you know it's not working?
billy



Joined: 16 Aug 2013
Posts: 2

View user's profile Send private message

PostPosted: Mon Aug 19, 2013 12:44 am     Reply with quote

Stinky,

My code is quite simple. made an output high for LED. After programming the pic, put in my development board. LED is not on when powering up.
If I simulate the program in proteus, the program is working.
Ttelmah



Joined: 11 Mar 2010
Posts: 19553

View user's profile Send private message

PostPosted: Mon Aug 19, 2013 1:12 am     Reply with quote

The point is that what you post does not show the LED code.

Anyway some comments inline:
Code:

#include <12F615.h>
#device adc=10

#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOPROTECT //Code not protected from reading
#FUSES IOSC8 //INTOSC speed 8 MHz
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOPUT //No Power Up Timer

#use delay(clock=8000000)
#define LED PIN_xx //Select to suit your LED

void main()
{
   setup_adc_ports(sAN3|VSS_Vref);
   setup_adc(ADC_CLOCK_INTERNAL);
   //Read the data sheet. Is this a legal ADC clock at this CPU clock....
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DIV_BY_16,255,1);
   setup_comparator(NC_NC_NC_NC);
   do
   {
      output_toggle(LED);
      delay_ms(1000);
   } while (TRUE);
}
//This shows flashing an LED
//Things that would stop it working:
//1) Choosing pin A3 for the LED - this is _input only_.
//2) Not having a suitable current limiting resistor on the LED
//If the LED is wired directly, it'll short out the PIC, odds are it'll reset
//and nothing will apparently happen.
//3) Choosing pin A4 for the LED. This is AN3, which you are setting
//as an analog input.


Read the inline comments.

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