📄 pdown.c
字号:
//********************************************************************
//
// Author : ADI - Apps www.analog.com/MicroConverter
//
// Date : October 2003
//
// File : PDown.c
//
// Hardware : ADuC842/ADuC843
//
// Description : Demonstrates a use of a timer interval counter to
// wake the ADuC842 out of Power down mode after a user
// specified Power down time.
//
// The LED will, on power up, flash at 5Hz. After 5s
// the ADuC842 will enter power down mode (the LED will
// stop flashing in the off position).
//
// By pressing the external interrupt 0 button (INT0) or
// when the user specified time runs out (20s in this
// example) the ADuC842 will wake up and continue
// blinking as before for 5s before entering power down
// mode again.
//
//********************************************************************
#include <stdio.h>
#include <ioADuC842.h>
#define adcled P3_bit.P33
#define LED P3_bit.P34 //P3.4 drives red LED on eval board
void DELAY(int);
#pragma vector=extern0
__interrupt void int0 ()
{
}
#pragma vector=TII_int
__interrupt void TIC_int ()
{
}
void main (void)
{
int i;
IEIP2 = 0xA4;
TCON_bit.IT0 = 1;
IE_bit.EX0 = 1;
IE_bit.EA = 1;
while(1)
{
for(i=0;i<50;i++)
{
DELAY(17000);
LED ^= 1;
}
INTVAL = 0x14;
TIMECON = 0x13;
LED = 1;
PCON = 0x22;
TIMECON = 0x00;
}
}
void DELAY(int length)
{
while (length >=0)
length--;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -