89C51 (8051) Keil programming help

Thread Starter

Uridan

Joined Jun 11, 2009
11
Hi

I am using keil to program the AT89C51 microcontroller and I am trying to put the micro into idle mode by using a counter or an interup.

I currently set PCON |= 0x01 // Micro on IDLE mode set.

The problem is, I dont know how to wake it up after it goes to Idle mode (I must wake it up after 60 sec). I never used interups or anything similar so can you provide me with a simple example of an IDLE and wake up mode using Keil pls??

Thanks
Regards
Ed
 

Arm_n_Legs

Joined Mar 7, 2007
186
This statement is extracted from the 89C51 datasheet:

"The idle mode can be terminated either by any enabled interrupt (at which time the process is picked up at the interrupt service routine and continued), or by a hardware reset which starts the processor in the same manner as a power-on reset."
 

GetDeviceInfo

Joined Jun 7, 2009
2,196
I personally perfer the 895131 of which I use power down modes for battery driven devices.

The one problem I've found is that in waking these devices, the Int must be released before execution resumes, which addes circuitry. In the 5131 however, you can program the keyboard interface port to wakeup from idle or power down with a number of int possibilities.
 

Arm_n_Legs

Joined Mar 7, 2007
186
The C8051F930 is also meant for battery operated device. It can be waken by a match of logic on its IO pins, or by a ultra low power smart clock with programmable alarm.
 

Thread Starter

Uridan

Joined Jun 11, 2009
11
I personally perfer the 895131 of which I use power down modes for battery driven devices.

The one problem I've found is that in waking these devices, the Int must be released before execution resumes, which addes circuitry. In the 5131 however, you can program the keyboard interface port to wakeup from idle or power down with a number of int possibilities.

How do you actully do the interupt by a the keyboard? you used serial interupts for that ? Can you explain how it is done? tks.
 

GetDeviceInfo

Joined Jun 7, 2009
2,196
The P1 port of the 89C5131 has an alternate function of 'keyboard' inputs. I don't use them for keyswitches, but rather for thier interrupt capabilities.

On any of these port pins you can enable an interrupt for either a high or low level. Interrupts on any of the pins in this port vector to the same location so you must poll the port register to see which line recieved the interrupt.

The nice thing is that these interrupts wake the device from powerdown mode with a simple change of state on the port pin. This is unlike the INT0,INT1 pins which require an activation and a release before waking the device.

The port is laid out to utilize a matrix keypad, waking the device on keystroke. I use the port for a variety of triggers.
 
Top