View previous topic :: View next topic |
Author |
Message |
dap20
Joined: 11 Aug 2011 Posts: 5
|
PLL with PIC18F45K20 |
Posted: Mon Dec 12, 2011 11:06 am |
|
|
I have been working with the pic18f45k20 with the internal oscillator with PLL on, I follow the .h file and there is an error.
to make it work to 64MHz from 16MHz clock I had to write:
Code: |
setup_oscillator(0x70); //see osccon register on datasheet
|
not
Code: |
#define OSC_64MHZ 0x4070 as seen in the .h file.
|
writting 0x70 fix the problem |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Dec 12, 2011 1:26 pm |
|
|
But what is your compiler version ? |
|
|
dap20
Joined: 11 Aug 2011 Posts: 5
|
|
Posted: Mon Dec 12, 2011 1:31 pm |
|
|
pcwhd version 4.120 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Dec 12, 2011 2:12 pm |
|
|
I tested the following program just now in hardware with vs. 4.120 and
it works fine. It blinks the LED at a 1 Hz rate. This was tested on an
Olimex PIC-P40 board, with the 3.3v jumper installed.
Code: |
#include <18F45K20.h>
#fuses INTRC_IO, NOWDT, BROWNOUT, PUT, NOPBADEN
#use delay(clock=64M)
//=========================================
void main()
{
// Blink LED once per second.
while(1)
{
output_toggle(PIN_A0);
delay_ms(500);
}
} |
|
|
|
dap20
Joined: 11 Aug 2011 Posts: 5
|
|
Posted: Mon Dec 12, 2011 2:18 pm |
|
|
It may jump to the low freq. oscillator. did you measure the output on PINA6, it should be 16MHz if you use #FUSE INTRC |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Dec 12, 2011 2:41 pm |
|
|
I get 16 MHz on pin A6 (with INTRC fuse). |
|
|
|