View previous topic :: View next topic |
Author |
Message |
hello188
Joined: 02 Jun 2010 Posts: 74
|
EC mode vs HS mode |
Posted: Wed Jun 02, 2010 8:08 pm |
|
|
Hi, I am trying to drive PIC18F66J90 with external clock source (31Khz from FLUKE calibrator).
I am checking the functionality by simply generating pulse on one of the output ports and checking the output by oscilloscope.
When I set the fuse to HS, the device works fine except it consumes about 900uA.
I am trying to cut down on the current consumption. My application needs about 125Khz and if I use the internally generated clock, that consumes about 500uA.
I want to drive the MCU in EC mode with PLL enabled. However, it doesn't seem to be working and the PIC automatically switches to its default 4Mhz internal oscillator.
Anybody has idea as to why it's not working?
Would using EC mode instead of HS mode reduce the current consumption? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jun 03, 2010 11:36 am |
|
|
According to the 18F66J90 data sheet, the PIC has an ECPLL mode which
should do what you want. CCS unfortunately doesn't use that name
for the fuse setting. They use E4_SW. Try the following program.
If it doesn't work, then post your compiler version.
Code: |
#include <18F66J90.h>
#fuses E4_SW, NOWDT
#use delay(clock=131072)
//================================
void main()
{
setup_oscillator(OSC_NORMAL | OSC_PLL_ON); // Enable 4x PLL
while(1)
{
output_high(PIN_B0); // Blink an LED on Pin B0
delay_ms(500);
output_low(PIN_B0);
delay_ms(500);
}
}
|
|
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Thu Jun 03, 2010 12:00 pm |
|
|
An extra comment:
With some chip models, to enable the PLL you have to remove power after programming the fuses. |
|
|
hello188
Joined: 02 Jun 2010 Posts: 74
|
tried |
Posted: Fri Jun 04, 2010 12:45 am |
|
|
My compiler version is 4.099
I tried your code and it doesn't seem to work.
I modified your code to see few things
Code: | #include <18F66J90.h>
#fuses E4_SW, NOWDT
#use delay(clock=131072)
int8 counter = 0;
//================================
void main()
{
while(1)
{
counter++;
if(counter==5) setup_oscillator(OSC_NORMAL | OSC_PLL_ON);
output_high(PIN_B0); // Blink an LED on Pin B0
delay_ms(500);
output_low(PIN_B0);
delay_ms(500);
}
}
|
The microcontroller seems to stop when setup_oscillator command is issued.
In fact, turning on PLLEN bit with #fuse of E4_SW, seems to stall the processor forever. |
|
|
|