|
|
View previous topic :: View next topic |
Author |
Message |
karthickiw
Joined: 09 Aug 2007 Posts: 82 Location: TN, India
|
problem with internal oscillator of PIC16F676 and CCS v4.057 |
Posted: Sun Aug 03, 2008 7:18 am |
|
|
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
|
|
Posted: Sun Aug 03, 2008 8:29 am |
|
|
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 |
|
|
|
|
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
|