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

problem with internal oscillator of PIC16F676 and CCS v4.057

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



Joined: 09 Aug 2007
Posts: 82
Location: TN, India

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

problem with internal oscillator of PIC16F676 and CCS v4.057
PostPosted: Sun Aug 03, 2008 7:18 am     Reply with quote

hai friends,

i write simple problem for testing the 16F676 IC. i write the program for blink the LED in port A0 pin.

Header file
Code:

#include <16F676.h>
#device adc=8

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES INTRC_IO                 //Internal RC Osc, no CLKOUT
#FUSES PROTECT                  //Code protected from reads
#FUSES BROWNOUT                 //Reset when brownout detected
#FUSES NOMCLR                   //Master Clear pin used for I/O
#FUSES CPD                      //Data EEPROM Code Protected
#FUSES PUT                      //Power Up Timer
#FUSES BANDGAP_HIGH         
#use delay(clock=4000000)



Program File
Code:
#include "C:\Documents and Settings\karthic\Desktop\check 2\main.h"


void main()
{

   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_comparator(NC_NC);
   setup_vref(FALSE);

   // TODO: USER CODE!!
   while (true)
   {
   output_high(pin_a0);
   delay_ms(200);
   output_low(pin_a0);
   delay_ms(200);
   }
   

}




pls check the program if i make any program with internal oscillator set up. give solution for my program.

my CCS C version is 4.057
Ttelmah
Guest







PostPosted: Sun Aug 03, 2008 8:29 am     Reply with quote

Have you erased the chip?.
On chips with the internal oscillator, there is an extra instruction at the top of memory, that returns the oscillator configuration byte. On these chips, if you perform a 'full erase', this byte _will_ be destroyed, and the chip, then won't work. Most programmers have an option to 'protect' this byte (they read it, and write it back after such an erase), but if this option is not selected, and the chip is erased, then code using the internal oscillator will not work.
You can get the chip working, by writing a 'dummy' value back into this location. The oscillator will no longer be calibrated, but it'll then run. Do a search here, an you will find how to do this.

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