Feb 5, 2015 #1 L 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;
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;
Feb 5, 2015 #2 M milan.rajik Banned Joined Apr 1, 2013 Messages 2,524 Helped 540 Reputation 1,078 Reaction score 524 Trophy points 1,393 Activity points 0 Zip and post complete mikroC project files.
Feb 5, 2015 #3 paulfjujo Advanced Member level 4 Joined Jun 9, 2008 Messages 1,467 Helped 298 Reputation 596 Reaction score 284 Trophy points 1,363 Location France 01800 Activity points 10,586 hello for 18F use : Code: LATB = ~LATB;
Feb 7, 2015 #4 L 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 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).
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).