Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Microcontroller consuming more current

Status
Not open for further replies.

chanchal.chauhan

Full Member level 4
Joined
Apr 23, 2009
Messages
216
Helped
5
Reputation
10
Reaction score
1
Trophy points
1,298
Location
Hyderabad, India
Activity points
2,539
I am using PIC16f506 microcontroller. Here microcontroller is drawing 540uA current.
I am using 4Mhz INTosc clk frequency & all peripheral is disable.

In my configuration bits WDT & CP is disable, MCE is RB3/MCLR function as RB3.

Below is the code which i have used.

#include<htc.h>


void main()
{
OSCCAL=0b00000000;
CM1CON0=0b00000000;
CM2CON0=0b00000000;
VRCON=0; // Disable CVref
OPTION=0b11000000; //prescale 1:256
TRISB=0xff;
TRISC=0xff;
ADCON0=0b00111101;
while(1)
{

}
}
Please let me know why its happening? any suggestion is helpful for as.

Regards
Chanchal Chauhan
 

What are you trying to achieve? Regular current consumption in run mode is specified with 625 uA. If you want
to reduce the current, use sleep mode. Also you have to care about floating input pins.
 
I know only one thing that is sleep mode to reduce the off mode current.
How to use /To and /PD bit in status register to wake up from sleep mode?
I want to use periodic wake up from sleep mode.
Its little bit tricky in C language.

Regards
Chanchal
 

For a periodic wakeup, enable the WDT and execute sleep instruction. Most likely, you'll find examples or tutorials
with specific C syntax for your favourite PIC C compiler.
 
Is there required startup code ?
What is start up code?

see the below mail
The /TO and /PD bits DO NOT cause a wakeup. They only report the type of the last reset. Read the section of the datasheet I mentioned above. You would also need to preserve the GPWUF bit for inspection in main() if you are doing a wake-up on GPIO change. In that case you would probably also want the initial GPIO value so you would need startup code to copy STATUS and GPIO to persistent global variables. The variable must be GLOBAL so it can easily be accessed from assembler and PERSISTENT so the C startup does not modify it.

Search the Hitech documentation for powerup.as to find out how to patch your own code in before the startup code.
You will also find a tutorial on using SLEEP here:
Gooligum Electronics - Baseline PIC C Programming Tutorials

That tutorial assumes that the compiler generated C startup code does not smash the STATUS register, which cannot be guaranteed if you change compilers or compiler versions. Intercepting the startup and preserving the original STATUS contents elsewhere will work on any compiler that lets you patch the startup code.

Regards
Chanchal
 

see the below mail

I am sure the author of that mail can explain to you in far better terms what exactly s/he meant by the words.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top