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 support@ccsinfo.com

Can't get PIC16F18326 in Low Power mode

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



Joined: 13 Apr 2011
Posts: 417

View user's profile Send private message

Can't get PIC16F18326 in Low Power mode
PostPosted: Mon Jul 10, 2017 3:27 pm     Reply with quote

I making a program to test current consumption in low power of a PIC16F18326.
So I put a 32768KHz crystal as main external oscillator and nothing more.

Code:
#include <16F18326.h>
#FUSES PROTECT,NOWDT,LP,NOBROWNOUT,NOLVP,NOFCMEN,NOMCLR,NOPUT,LPBOR,BORV27
#use fast_io (ALL)

#byte PMD0 = getenv("SFR:PMD0")
#byte PMD1 = getenv("SFR:PMD1")
#byte PMD2 = getenv("SFR:PMD2")
#byte PMD3 = getenv("SFR:PMD3")
#byte PMD4 = getenv("SFR:PMD4")
#byte PMD5 = getenv("SFR:PMD5")

void main(void)
{
   set_tris_a(0b00000000);
   set_tris_c(0b00000000);
   setup_timer_0(T0_INTERNAL|T0_DIV_32);
   clear_interrupt(INT_TIMER0);
   
    PMD0=0b01111111;
    PMD1=0b11111110;//Habilito Timer0
    PMD2=0b11111111;
    PMD3=0b11111111;
    PMD4=0b11111111;
    PMD5=0b11111111;
   
    output_toggle(PIN_C1);
    enable_interrupts(INT_TIMER0);
   
   set_timer1(0);

   while(1)
   {
      output_toggle(PIN_C2);

      while(!interrupt_active(INT_TIMER0))//500mSec. interrupt
      {
         delay_cycles(1);
      }   
      
      clear_interrupt(INT_TIMER0);      
   }      
}


And I'm getting not less than 42µA@3.8V if I put the internal LDO in low power mode.

I'm new on this microcontroller.
I check OSCCONx, WPUx and so to disable them.

This microcontroller has so many registers that probably I'm forgetting something.

Could you provide some suggestions?
_________________
Electric Blue
temtronic



Joined: 01 Jul 2010
Posts: 9134
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Jul 10, 2017 3:57 pm     Reply with quote

While I don't use that PIC a general comment to obtain 'low power' you must turn off EVERY peripheral that can be attached (accessed) to EVERY I/O pin. Obvious ones are ADC, comparators,UARTs, etc. Then of course, each pin should be set low or high never ever left 'floating'.
You should read Microchip's app notes about low power modes, I'm sure there are several but the one from 20 years ago still applies today !

Jay
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jul 10, 2017 6:20 pm     Reply with quote

One problem is that the datasheet for the 1618326 is very preliminary.
They don't even have a section for the LP oscillator. They don't list
power consumption specs for 5.0v, so there is no way to extrapolate
to the 3.8v Vdd that you're using.

Also, 3.8v is somewhat of an oddball voltage in terms of low power usage.
Microchip in terms of their specs, really believes that low power is for 3.0v
and below.

If you look at the 16F1847 datasheet in the Electrical section, you can
see it's a much more fully spec'ed out PIC:
http://ww1.microchip.com/downloads/en/DeviceDoc/40001453E.pdf
Look at this table on page 350:
Quote:
TABLE 30-2: SUPPLY CURRENT (IDD)

If we look at data D010A which is for the "F" version, we can extrapolate
about 28 ua @ 3.8v. That's not terribly different from what you're getting.
E_Blue



Joined: 13 Apr 2011
Posts: 417

View user's profile Send private message

PostPosted: Tue Jul 11, 2017 12:28 pm     Reply with quote

I will change to PIC16F1826, seems to have a couple of years in the market.
_________________
Electric Blue
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