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.

press and hold key for ON/OFF controll

Status
Not open for further replies.

binojkumar

Full Member level 3
Joined
Jul 19, 2004
Messages
151
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,298
Location
Bangalore
Activity points
983
Entering in power down mode and exiting

Hi friends im looking for an idea for with external interrupt micro system should goes to power down, and when i evoke same interrupt again it should exit power down mode and do normal operation.\\
Im able to enter in to power down mode but it is not exiting and not doing normal operation when i ivoke interrupt.
i used ex int0.


Key_Press
{
my task(); //
power down bit configuring

}

Key_Press
{
exiting from power down mode
and starts normal operation
}

This is my idea, pls help me to implement this.
 
Last edited:

I have no idea about turn OFF the micro-controller using a switch,But i have used a switch for turning the micro-controller ON,
what i have done is that whenever a switch is pressed the micro-controller turn ON and if no function is perform after a certain time the micro-controller automatically turn OFF.
would this scheme helpful for u.
 

Yes,That means you want to do that like that done in our PC's for reset .8051 has a watch dog timer you can use that if you only want to stop only some resources or connect a relay between a port pin on to the 8051 to the regulators ground with a relay keep a switch whose debounce time should be as required by you,Once that is matched you can activate relay which will open the connection between system ground and ground of 8051
 

a state machine is the best way to go.
 

you must setup an interrupt routine JUST BEFORE 'going to sleep()' depending on the microcontroller,
(by the way which micro are you using?)
you can make something like this (incomplete source-idea)
Code:
#define OFF 0
#define ON 1
volatile char status=ON; //the first time i'll plug vcc it will arise!

ISR(external_interrupt){
 if(status==OFF)
  status=ON;
 else
  status=OFF;
}

void isr_init(void){
//... fill with your external interrupt initialization
}

void power_down(){ //must call this routine all the times...
 if (status==OFF){ //must turn off
  //...  enable interrupts.
  //prepare to shut down...
 //like disabling peripheral, slowing the clock, etc.
  Sleep(); //turned off..
 nop(); //or something dummy... mostly this will or will not operate
 //when the interrupt happens,
 //if enabled, will run the isr and
 //continues in this same place
 //... so here comes... the...

//power up!
// retake your tasks...
 // clock up, reanble peripheral and so...!
}
}


void main(void){
 main_init();
 isr_init();
 //enable interrupt some where!
 enable_interrupt(); //or something...
 

 //most the time, your code is an eternal loop something like
 for(;;){
  power_down(); //if status is ON it will not do anything... if status is OFF it will turn off (and resume appropriately)...
   ...

  ...
  ... // your actual program here..
 }
}
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top