HI all,,,, I need a small help from you all.... actually i am new to electronics and programming part. i am making a small project in which i need to enter the idle mode to save the battery consumption done by my 89S52. i have written a code to enter the idle mode...
PCON |=0x01;
my microcontoller has entered the idle mode but not aware of how to exit it... have gone through the data sheet twice but not able to understnad anything... yes.... understood a bit... so in that case i wrote a code to exit idle mode...
EX1=1; EX0=1; ES=1; IE1=1; IE0=1; EA=1;
but ths thing does not work..... i want to exit the idle mode on a keypress... can nybody help me with the code....
You didn't realized that the " at the end was there by mistake?
Or that you could also recover the original link by trying Google yourself?
Or that since the link specified this very site, you could locate the information by specifically visit Keil's download area?
So you never did look at the data in the ZIP file available on this link? http://www.keil.com/download/docs/188.asp which happens to be: http://www.keil.com/download/files/8051_ex0.zip which happens to contain source 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) { /*----------------------------------------------- Configure INT0 (external interrupt 0) to generate an interrupt on the falling-edge of /INT0 (P3.2). Enable the EX0 interrupt and then enable the global interrupt flag. -----------------------------------------------*/ IT0 = 1; // Configure interrupt 0 for falling edge on /INT0 (P3.2) EX0 = 1; // Enable EX0 Interrupt EA = 1; // Enable Global Interrupt Flag /*----------------------------------------------- Wait forever. -----------------------------------------------*/ while (1) { } } /*============================================================================= =============================================================================*/
By the way - your original post does show C code. Now you start talking about RET or RETI - which implies you suddenly are talking about the instruction set of the processor. RETI is the special instruction needed to return from an ISR, while RET is the instruction to return from a normal sub-routine. And the C compiler already knows this - so if you write an ISR in the way documented in the compiler manual you will automatically get the correct return instruction.
You don't seem to be a problem solver. When you get stuck you don't spend much time trying before giving up or dropping off in a different direction. Programming is about logic. So spend some logic thinking on your problems. It will really improve your progress. Wildly testing random statements like some magical arcane spells (like what you listed in your previous post) isn't a good way to solve your problem.
as you said...When i get stuck i don't spend much time trying before giving up. but the thruth is i had almost spent more than a month trying to solve this.... and i think.... today its almost done.... anyways.... thanks a lot..... i really appreciate yourr help... will be bACK soon with mmy othher problems.... hope you won't mind solving it again.... lolzz