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.

exit power down mode in 89s52

Status
Not open for further replies.

gauravkothari23

Advanced Member level 2
Joined
Mar 21, 2015
Messages
640
Helped
5
Reputation
10
Reaction score
4
Trophy points
1,298
Activity points
6,922
Hi all....
i am making a small project on 89S52 and trying to exit power down mode using Keil...
i am using a 4x4 keyad which has a off Button... which on pressed enter the power down mode....
i am using INT0 in which connection a button to exit power down mode....
system is battery operated....
code
Code:
#include <REG52.H>

unsigned char ex0_isr_counter = 0;
void ex0_isr (void) interrupt 0
{
ex0_isr_counter++;   // Increment the count
}

void main (void)
{
IT0 = 1;   // Configure interrupt 0 for falling edge on /INT0 (P3.2)
EX0 = 1;   // Enable EX0 Interrupt
EA = 1;    // Enable Global Interrupt Flag
 PCON |= 0x02; 
while (1)
  {
  }
}
but i am not able to exit the power down mode in this case....
but if i write
PCON |= 0x01; (Enters the Idle Mode)
in which it easily exits idle mode....
reading the datasheet... says me to reset the WDT... how can it be done....
 

Try attached Simulation.

https://techknowlearn.blogspot.in/2013/09/power-saving-mode-operation-of.html

Only RESET button can wake up from Power Down mode.

I have set PCON bit 1 to 1 using PCON |= 0x02 and it is correct. It is power down mode.

Remember in power mode down the port status are retained and if a LED or relay is ON then it remains ON and consumes power. If you want to save power then turn OFF all devices connected to microcontroller after saving the device states and then enter power down mode. On wake up assign port status to ports.

Test without no devices connected to 8051 and check current consumption by 8051 in power down mode. It should be in uA.

In the attached project discard the code related to INT0.


https://iitestudent.blogspot.in/2011/11/power-saving-modes-of-operation-of-8051.html

Only RESET to wake from power down mode.

External Interrupts will be frozen in Power down mode. You can't trigger it to wake up.
 

Attachments

  • PWR DWN rev1.rar
    25.9 KB · Views: 80
Last edited:

Only level triggered interrupts can exit the PD mode.
 

Read the interrupt section of the datasheet, IT0 = 0 for level triggered operation.
 

Don't test it in Proteus. It will not work. I have tested that in Proteus. I have used

Code:
IT0_bit = 0;
EX0_bit = 1;

just before entering power down mode and then used

Code:
EX0_bit = 0
in INT0 ISR.
 

the datasheet says....
WDT During Power-down and Idle
In Power-down mode the oscillator stops, which means the WDT also stops. While in Powerdown mode, the user does not need to service the WDT. There are two methods of exiting Power-down mode: by a hardware reset or via a level-activated external interrupt which is enabled prior to entering Power-down mode. When Power-down is exited with hardware reset, servicing the WDT should occur as it normally does whenever the AT89S52 is reset. Exiting Power-down with an interrupt is significantly different. The interrupt is held low long enough for the oscillator to stabilize. When the interrupt is brought high, the interrupt is serviced. To prevent the WDT from resetting the device while the interrupt pin is held low, the WDT is not started until the interrupt is pulled high. It is suggested that the WDT be reset during the interrupt service for the interrupt used to exit Power-down mode. To ensure that the WDT does not overflow within a few states of exiting Power-down, it is best to eset the WDT just before entering Power-down mode.
i am not getting this point.... how can i reset the WDT...
 

You are considering a non-existing problem. The watchdog timer (WDT) is disabled by default, so it can't disturb your program.

The quoted text is talking about how to avoid unwanted resets with power down mode if you have enabled the WDT. But you didn't. In case you want to use it, read the watch dog timer section of the data sheet, telling you how to enable and reset the WDT.
 

You are considering a non-existing problem. The watchdog timer (WDT) is disabled by default, so it can't disturb your program.

The quoted text is talking about how to avoid unwanted resets with power down mode if you have enabled the WDT. But you didn't. In case you want to use it, read the watch dog timer section of the data sheet, telling you how to enable and reset the WDT.

i thought WDT has something to do with power down mode....
anyways....
for power down mode...
i tried IT0=0;
and then tried entering power down mode... it does...
but still having problem in getting out of it...
 

You are considering a non-existing problem. The watchdog timer (WDT) is disabled by default, so it can't disturb your program.

The quoted text is talking about how to avoid unwanted resets with power down mode if you have enabled the WDT. But you didn't. In case you want to use it, read the watch dog timer section of the data sheet, telling you how to enable and reset the WDT.

can you give me the solution for this
 

please help me... i tried a lot.. but i am not getting a proper output...
what should i do...
 

Hi,

If you want to exit power down mode with an external interrupt, then forget about WDT.

**

I don´t know about your microcontroller (and I don´t want to read the datasheet either).
In general:
External interrupts are I/O pins. Often called INT0, INT1.... --> decide what IO pin (with interrupt capability) you want to use
Often a low level triggers an interrrupt. --> you need a pullup (external or internal) to ensure it is per default high level.
You need to setup this pin for "low level interrupt", enable this interrupt.
You need an ISR for this interrrupt. The simplest program is just a "return from interrupt". But for debugging you could toggle an output pin(I).
You need to enable global interrupts.
(for debugging you could set an output pin(M) to LOW
You need to prepare the microcontroller for "power down mode"
You need to activate power down
(for debugging you could set an output pin(M) to HIGH)

(for debugging you could just wait until INT is released, then wiat for some milliseconeds and then go back to where the pin(M) is set LOW)

****
pin(I) is any available pin, configured as output to indicate the activity of the Isr
pin(M) is any available pin, configured as output to indicate the activity of the Main loop

*****
Try to make this. Step by step.
Connect a pushbutton to GND at the ISR input pin. --> press it for a short time to leave the power down mode.
Check INT pin voltage, pin(I) voltage and pin(M) voltage with a scope.
See what happens.

If you see any problem, then please post the complete schematic, the complete software and a detailed description of the problem.

Klaus
 

Hi,

If you want to exit power down mode with an external interrupt, then forget about WDT.

**

I don´t know about your microcontroller (and I don´t want to read the datasheet either).
In general:
External interrupts are I/O pins. Often called INT0, INT1.... --> decide what IO pin (with interrupt capability) you want to use
Often a low level triggers an interrrupt. --> you need a pullup (external or internal) to ensure it is per default high level.
You need to setup this pin for "low level interrupt", enable this interrupt.
You need an ISR for this interrrupt. The simplest program is just a "return from interrupt". But for debugging you could toggle an output pin(I).
You need to enable global interrupts.
(for debugging you could set an output pin(M) to LOW
You need to prepare the microcontroller for "power down mode"
You need to activate power down
(for debugging you could set an output pin(M) to HIGH)

(for debugging you could just wait until INT is released, then wiat for some milliseconeds and then go back to where the pin(M) is set LOW)

****
pin(I) is any available pin, configured as output to indicate the activity of the Isr
pin(M) is any available pin, configured as output to indicate the activity of the Main loop

*****
Try to make this. Step by step.
Connect a pushbutton to GND at the ISR input pin. --> press it for a short time to leave the power down mode.
Check INT pin voltage, pin(I) voltage and pin(M) voltage with a scope.
See what happens.

If you see any problem, then please post the complete schematic, the complete software and a detailed description of the problem.

Klaus

thank you all....
finally i have completed the code....
its working perfect.... but still there is one more problem...
why my system get restarted automtically after every 33rd on/off attempt....
here is my new thread....
https://www.edaboard.com/threads/349659/#post1493231
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top