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

PIC16f1823 and consumption during sleep

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



Joined: 21 Dec 2011
Posts: 42

View user's profile Send private message

PIC16f1823 and consumption during sleep
PostPosted: Mon Jan 15, 2018 8:15 am     Reply with quote

dear everyone,

I have made a very little circuit on a dev_board for playing with sleep/deepsleep and watchdog wake up.

My pcb wake up correctly every Xseconds but i have question about the electrical consumption.
In sleep mode, the consumption is around 23uA. It'seem not to be normal when i compare with the datasheet.




Code:

#device PIC16f1823
#include <16f1823.h>

#fuses  NOPROTECT
#fuses  WDT

#use delay(internal=8000000)
//------------------------------------------------
void main(void)
{
   setup_oscillator(OSC_8MHZ);
   setup_wdt(WDT_OFF);
   
   printf("Bonjour\n\r");


   setup_wdt(WDT_8S);
   setup_wdt(WDT_ON);
   sleep();
   RESET_CPU();
}
//------------------------------------------------


See my code above. If somenone see a big mistake.... i will be happy
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Mon Jan 15, 2018 9:01 am     Reply with quote

There are a standard set of comments about this:

1) Are _all_ inputs tied to something?. Either driven by the PIC to an idle state, or driven by an external circuit. Floating inputs will result in extra power being drawn.
2) Are you measuring the actual PIC consumption?. Remember things like regulators themselves draw power.
3) You probably have BOR enabled, since it is not being turned off in your fuses.

A search here will find quite a few threads about other things, but these are the first main ones.
joseph20480



Joined: 21 Dec 2011
Posts: 42

View user's profile Send private message

PostPosted: Mon Jan 15, 2018 10:11 am     Reply with quote

Thanks for your rapid reply.
I have made two things:
> Changed by board, now ONLY 16f1823/Prog Connector/MCLR resistor (I cannot make less minimal). there is no regulator, supply directly by a laboratory power supply (3.0v).
> Modified my code...

Code:

#device PIC16f1823
#include <16f1823.h>

#fuses WDT,PUT,INTRC_IO,NOMCLR,NOLVP,NOBROWNOUT,NOPROTECT   
#use fast_io(A)
#use fast_io(C)


#use delay(internal=4000000)       
//------------------------------------------------
void main(void)
{
   setup_wdt(WDT_OFF);
   
   delay_ms(500);

      output_low(pin_a0);
      output_low(pin_a1);
      output_low(pin_a2);
      //output_low(pin_a3); // MCLR PIN (200k)
      output_low(pin_a4);
      output_low(pin_a5);
      output_low(pin_c0);
      output_low(pin_c1);
      output_low(pin_c2);
      output_low(pin_c3);
      output_low(pin_c4);
      output_low(pin_c5);


   setup_wdt(WDT_4S);
   setup_wdt(WDT_ON);
   
   sleep();
   delay_cycles(1);

   RESET_CPU();
}
//------------------------------------------------


The pads for external conponents are free... every I/O from pic are tied to gnd by program.
My consumption is 19uA....
An idea ?
temtronic



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

View user's profile Send private message

PostPosted: Mon Jan 15, 2018 10:22 am     Reply with quote

you also need to disable all internal peripherals that may be on any pin.
such as
ADC
Comparators
UARTs
timers

While I don't use that PIC, today's PICs usually have 2,3 or MORE peripherals available on any/every pin !!

Unless these are disabled, they will draw 'some' power.

Also what VDD are you using? The ultra low power specs tend to be at say 2 or 3 volts not 5 volts. That information will be in the datasheet, usually there's a chart or 2, try 'electrical specs'...

Jay
newguy



Joined: 24 Jun 2004
Posts: 1908

View user's profile Send private message

PostPosted: Mon Jan 15, 2018 10:49 am     Reply with quote

Are you turning off the clock while you're going to sleep? What clock is driving the watchdog? If it's a fast clock, can you substitute a slower clock source?

Can you disable the clock altogether (watchdog too), and wake upon an external event (button press)? Your current consumption will be much smaller if you do.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 15, 2018 11:03 am     Reply with quote

temtronic, He said he's using 3.0v from a lab power supply.
-------------------

Look at the 16F1823 data sheet, in this section on page 330:
30.3 DC Characteristics: PIC12(L)F1822/16(L)F1823-I/E (Power-Down)
http://ww1.microchip.com/downloads/en/DeviceDoc/40001413E.pdf

The sections that are in gray are for the standard "F" part.
It says that for 3.0v, the typical power-down current is 22 ua, for
the following conditions:
Quote:
WDT, BOR, FVR, and T1OSC disabled, all Peripherals Inactive

22 ua is about what you are seeing. This is correct.

If you look at the non-grayed section, you will see a very low current
of 0.03 ua (30 nano-Amps). But this is for the "LF" version.

The "LF" version in the more modern PICs is not just a slightly better
power-down version. It's a lot better. You need to buy the "LF" chip.
joseph20480



Joined: 21 Dec 2011
Posts: 42

View user's profile Send private message

PostPosted: Mon Jan 15, 2018 11:06 am     Reply with quote

i have add these lines before sleep() but nothing more..

Code:

   setup_timer_1(T1_disabled);
   setup_vref(VREF_OFF);
   setup_dac(DAC_OFF);
   setup_adc(ADC_OFF);
   setup_spi(SPI_DISABLED);
   setup_oscillator(OSC_PLL_OFF);
   setup_ccp1(CCP_OFF);
   disable_interrupts(GLOBAL);
   setup_adc_ports(NO_ANALOGS);


I know that there is a lot a possibility for use on each pin. I'm little bit surprised, normal CCS don't start module by itself. is it true ?
My ccs version is 5.015
joseph20480



Joined: 21 Dec 2011
Posts: 42

View user's profile Send private message

PostPosted: Mon Jan 15, 2018 11:09 am     Reply with quote

PCM programmer wrote:
temtronic, He said he's using 3.0v from a lab power supply.
-------------------

Look at the 16F1823 data sheet, in this section on page 330:
30.3 DC Characteristics: PIC12(L)F1822/16(L)F1823-I/E (Power-Down)
http://ww1.microchip.com/downloads/en/DeviceDoc/40001413E.pdf

The sections that are in gray are for the standard "F" part.
It says that for 3.0v, the typical power-down current is 22 ua, for
the following conditions:
Quote:
WDT, BOR, FVR, and T1OSC disabled, all Peripherals Inactive

22 ua is about what you are seeing. This is correct.

If you look at the non-grayed section, you will see a very low current
of 0.03 ua (30 nano-Amps). But this is for the "LF" version.

The "LF" version in the more modern PICs is not just a slightly better
power-down version. It's a lot better. You need to buy the "LF" chip.


you seem to be my hero today !
The mistake is mine ! thanks everybody
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Tue Jan 16, 2018 9:04 am     Reply with quote

It's perhaps worth just noting that the consumption dropped by 4uA when you applied the little changes on making the pins not float etc.. Now this will be similar on the LF chip, so well worth 'bearing in mind' when you do get to the final version of the code/circuit.... Very Happy
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