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

12LF1822 POWER TEST

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



Joined: 23 Jun 2010
Posts: 19

View user's profile Send private message

12LF1822 POWER TEST
PostPosted: Wed Feb 16, 2011 10:10 am     Reply with quote

Hi everyone,

The following code was run on the 12LF1822 to test its power consumption rating:
Code:

#include <12LF1822.h>
#fuses INTRC_IO, NOWDT,NOPROTECT,NOMCLR,NOBROWNOUT,NOPUT,NOIESO,NOFCMEN,NOCPD
#use delay(clock=62KHZ)

#rom 0x8007 = {0b00100110100101}
#byte TXSTA = 0x21e 
#byte RCSTA = 0x21d

void main()
{
   TXSTA = 0x02;
   RCSTA = 0x08;
   output_float(PIN_A0);
   output_float(PIN_A1);
   //output_float(PIN_A2);
   output_float(PIN_A3);
   output_float(PIN_A4);
   output_float(PIN_A5);

   DISABLE_INTERRUPTS(GLOBAL);
   setup_SPI(SPI_SS_DISABLED);
   setup_DAC(DAC_OFF);
   SETUP_CCP1(CCP_OFF);
   setup_comparator(NC_NC);
   SETUP_ADC(ADC_OFF);
   SETUP_TIMER_1( T1_DISABLED );
   SETUP_TIMER_2( T2_DISABLED,0,1 );

   output_high(PIN_A2);
   
   while(1){   
      output_toggle(PIN_A2);
      delay_ms(500);
   }   
}
 

I am using MPLAB IDE version 8.50 and CCS C-compiler version 4.106.

The PIC has been set to ECL oscillator mode (last three least significant bit of Configuration Word 1 @ memory location 0x8007). External input clock pulse to PIN_A5 is 1V, 62KHz and supply to the PIC is 2 VDC. Output on PIN_A2 is a 155Hz pulse despite setting a 500ms delay.
Compiler kept giving an error with the EC_IO fuse. Additionally, to disable EUSART, we had to change the register settings as the compiler gave an error when using the setup_uart(0) with #use rs233.

Appreciate your comments and suggestions.

delesan
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 16, 2011 12:48 pm     Reply with quote

Quote:
output_float(PIN_A0);
output_float(PIN_A1);
//output_float(PIN_A2);
output_float(PIN_A3);
output_float(PIN_A4);
output_float(PIN_A5);

Don't set CMOS pins as floating input pins. Set them to be outputs and
set them low. Read this T.I. appnote on floating CMOS inputs:
http://focus.ti.com/lit/an/scba004c/scba004c.pdf
Read this section on page 5:
Quote:

Characteristics of Slow or Floating CMOS Inputs

Also note the graph in Figure 2 on page 6. When the input voltage floats
into the 1 to 2v range, the current goes way up.


Quote:

TXSTA = 0x02;
RCSTA = 0x08;

DISABLE_INTERRUPTS(GLOBAL);
setup_SPI(SPI_SS_DISABLED);
setup_DAC(DAC_OFF);
SETUP_CCP1(CCP_OFF);
setup_comparator(NC_NC);
SETUP_ADC(ADC_OFF);
SETUP_TIMER_1( T1_DISABLED );
SETUP_TIMER_2( T2_DISABLED,0,1 );

All these modules are disabled upon power-on reset. You don't need to
do it again. But the setup_spi() line is in fact enabling the SPI
module. If you want to turn it off, use FALSE as the parameter.
delesan



Joined: 23 Jun 2010
Posts: 19

View user's profile Send private message

12LF1822 power test
PostPosted: Thu Feb 17, 2011 1:38 am     Reply with quote

PCM programmer wrote:
Quote:
output_float(PIN_A0);
output_float(PIN_A1);
//output_float(PIN_A2);
output_float(PIN_A3);
output_float(PIN_A4);
output_float(PIN_A5);

Don't set CMOS pins as floating input pins. Set them to be outputs and
set them low. Read this T.I. appnote on floating CMOS inputs:
http://focus.ti.com/lit/an/scba004c/scba004c.pdf
Read this section on page 5:
Quote:

Characteristics of Slow or Floating CMOS Inputs

Also note the graph in Figure 2 on page 6. When the input voltage floats
into the 1 to 2v range, the current goes way up.


Quote:

TXSTA = 0x02;
RCSTA = 0x08;

DISABLE_INTERRUPTS(GLOBAL);
setup_SPI(SPI_SS_DISABLED);
setup_DAC(DAC_OFF);
SETUP_CCP1(CCP_OFF);
setup_comparator(NC_NC);
SETUP_ADC(ADC_OFF);
SETUP_TIMER_1( T1_DISABLED );
SETUP_TIMER_2( T2_DISABLED,0,1 );

All these modules are disabled upon power-on reset. You don't need to
do it again. But the setup_spi() line is in fact enabling the SPI
module. If you want to turn it off, use FALSE as the parameter.


Many thanks PCM Programmer. Will implement your suggestions. Meanwhile, there is still the issue about why the output on PIN_A2 is much faster than what was coded (delay_ms(500)).
Removing INTOC_IO fuse and replacing with EC_IO generates a compiler error.

Appreciate your comments and suggestions.

delesan
Beenabout



Joined: 19 Jan 2010
Posts: 7

View user's profile Send private message

PostPosted: Thu Feb 17, 2011 3:16 am     Reply with quote

I think what the querrant wanted to know was:

1. Why is the EC_IO fuse, specified in the device .h file, not accepted by the compiler?

2. Why does setup_uart(0) not work?

3. Why, despite specifying a #clock of 62KHZ and therafter applying an external clock of that frequency, does the delay statement used not give the delay expected?
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Thu Feb 17, 2011 5:59 am     Reply with quote

I think there is probably a number of 'parts' to this.

First, number3, the frequency. A search here will find a thread a few weeks ago, about a problem with delays and these chips. I'm sure the compiler version involved was around this one, and can confirm that an a quick test, the delay code is faulty, giving completely the wrong delay.

On the UART, I think the compiler only understands the primary UART pins. If I use:
Code:

#use RS232(XMIT=PIN_A0,RCV=PIN_A1,BAUD=300,ERRORS)

//Then in main,
   setup_UART(FALSE);

It all happily works. I was able to use the secondary pins, by doing this, then just manually selecting the pin move.
SETUP_UART, only works if the hardware UART is being used, and the compiler at this point, does not know about the relocatable pins. If you try to use the secondary locations, it does not work.

EC_IO, isn't complained about, but sets up the oscillator to use an external RC oscillator. This just appears to be somebody translating a new chip 'wrong', since these have three different EC modes, and none without 'IO'.

Basically, these chips are very new, and the settings for 4.106, are just plain 'wrong'. Moan to CCS particularly about the fuse, and the timings, and hopefully they will fix these and do an upgrade.

The fuses are fixed a couple of compiler versions latter, with ECM, ECL, and ECH modes, and no EC_IO.

However support for the secondary UART pins still seems to be absent.

Best Wishes
Beenabout



Joined: 19 Jan 2010
Posts: 7

View user's profile Send private message

PostPosted: Fri Feb 18, 2011 2:47 am     Reply with quote

Thanks for your reply, Ttelmah. It is clear that it is a compiler issue now and I hope CCS move on fixing their latest version to work well with the 1822 and 1827 chips as these are very versatile PICs. Besides, we want to use them in our Embedded Systems 3rd Year course next year and it would be a shame to have to rewrite the course to use another, more functional, compiler.

From our end I can confirm that we have had the 16F1822 operating at just 1V VDD (producing a 155HZ output on an IO pin) whilst consuming just 2uA, driven by an external clock at 62kHZ. That is a total of 2uW consumption for a maximum of around 15000 instructions per second.

Kind regards.
Beenabout



Joined: 19 Jan 2010
Posts: 7

View user's profile Send private message

PostPosted: Fri Feb 18, 2011 6:43 am     Reply with quote

Sorry that should be a 12F1822. Not had a chance to test the 16F1827 for power consumption yet, although I do know that the capacitive touch routines do not work on it and that it requires a 16MHz clock for the software RS232 routines to run properly (most others I have tried run well at 8MHz).
Plater



Joined: 21 Feb 2013
Posts: 8

View user's profile Send private message

PostPosted: Thu Feb 21, 2013 4:14 pm     Reply with quote

Was this ever resolved?
I am using the same chip (Well 12LF1822) with the internal oscillator at 31kHz. I cannot get below about 90uA when in sleep mode.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 21, 2013 4:56 pm     Reply with quote

This is an old thread with an old verion. Best to leave it closed.
Start a new thread, post your low-power test program. Make it be a
short program. And post your full compiler version. Example of versions:
http://www.ccsinfo.com/devices.php?page=versioninfo
Post all other test conditions too, such as the Vdd voltage of the PIC, and
a list of manufacturers and part numbers of external circuit components,
especially the voltage regulator. Post a link to a schematic of your
board, if you can.
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