CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

EC mode vs HS mode

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
hello188



Joined: 02 Jun 2010
Posts: 74

View user's profile Send private message

EC mode vs HS mode
PostPosted: Wed Jun 02, 2010 8:08 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jun 03, 2010 11:36 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jun 03, 2010 12:00 pm     Reply with quote

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

View user's profile Send private message

tried
PostPosted: Fri Jun 04, 2010 12:45 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group