New to PIC18F2550 and MiKroC 6.4.0

Status
Not open for further replies.

lachmannmarcel

Junior Member level 3
Joined
Jan 15, 2011
Messages
29
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Romania
Activity points
1,431
Hi
I downloaded MikroC 6.4.0 and i try my first program: blinking led. I have one led on RB7. No Qtal just internal osc.

This is my code
Code:
void main() {
   PORTB=0;
   TRISB=0;
   CMCON = 0x07;   // Disable comparators
   ADCON1 = 0x0F;  // Disable Analog functions

   while(1){
   PORTB = ~PORTB;
   Delay_ms(1000);
   }
}
Ok is working, BUT 1 second delay is in fact 9 seconds.
What settings do i have to changes to oscilator to work properly?

- - - Updated - - -

fixed with
Code:
  OSCCON.IRCF0=1;///Internal Oscillator Frequency Select bits, 8Mhz
   OSCCON.IRCF1=1;
   OSCCON.IRCF2=1;
 

Zip and post complete mikroC project files.
 

No need. I just fixet. It look that in Mikroc when you fix clock in fact is only a declaration for delay function (like XTAL_Frec from Hitech C).
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…