PDA

View Full Version : Running led blink at 64mhz with 18f26k22.



sccoupe
- 29th April 2011, 03:11
I have used the 12f628 for a long time and have moved on to the 18f26k22 for more horsepower. I am using the code below to blink an LED, but it blinks far slower than 500ms. In the programmer dropdowns, the PLL is enabled, but to what multiplier? Sould the OSCCAL be set to 16mhz with an x4 PLL or is the OSCCON set to 64mhz? Its a little confusing. I want to run at 64mhz on the internal OSC.

Thanks

Jason



define OSC 64
DEFINE OSCCAL_1K 1
LED VAR PORTB.0

mainloop:
High LED
Pause 500
Low LED
Pause 500
Goto mainloop

End

sccoupe
- 29th April 2011, 18:41
Got it!



define OSC 64
DEFINE OSCCAL_1K 1
OSCCON=%01110000
OSCTUNE=%11000000
LED VAR PORTB.0

mainloop:
High LED
Pause 500
Low LED
Pause 500
Goto mainloop

End

cncmachineguy
- 29th April 2011, 18:58
Great Job!!! :):):)