Continue to Site

Lost Oscillator Calibration?

Status
Not open for further replies.

ahmet2004

Member level 3
Member level 3
Joined
Jan 1, 2004
Messages
63
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Activity points
383
Code:
#include <12F675.h> 
#device ADC=10 
#fuses INTRC_IO,NOWDT,NOPUT,NOPROTECT,NOCPD,NOMCLR 
#use delay(clock=4000000) 
#define GP0 PIN_A0 
#define GP1 PIN_A1 
#define GP2 PIN_A2 
#define GP3 PIN_A3 
#define GP4 PIN_A4 
#define GP5 PIN_A5 
#byte OSCCAL = 0x90 

void init() 
{ 
OSCCAL = 0x80; // set internal oscillator to mid frequency 
set_tris_a( 0b11111101 ); // set GP1 output, all other inputs 
setup_comparator( NC_NC_NC_NC ); // disable comparators 
setup_adc_ports( NO_ANALOGS ); // disable analog inputs 
setup_adc( ADC_OFF ); // disable A2D 
} 
main() 
{ 
init(); 
while ( TRUE ) // blink LED 
{ 
output_high( GP1 ); // turn LED on 
delay_ms( 250 ); // wait 250ms 
output_low( GP1 ); // turn LED off 
delay_ms( 250 ); // wait 250ms 
} 
}
 

Hi,

I dont know what Compiler you are using ( im using Hi-T*ch ) but it looks like you are forgeting to tuen the internal OSC.
In your #fuses you have to set the INTOSC, so the pic will know that it is using the internal OSC.
Also, you dont need the OSCCAL. The default is 0x80.
Good luck.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top