⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pdown.c

📁 aduc831精典源代码,适合初学者学习
💻 C
字号:
//********************************************************************
//
// Author        : ADI - Apps            www.analog.com/MicroConverter
//
// Date          : May 2002
//
// File          : PDown.c
//
// Hardware      : ADuC831
//
// Description   : Demonstrates a use of a timer interval counter to
//		wake the ADuC831 out of Power down mode after a user
//		specified Power down time.
//
//		The LED will, on power up, flash at 5Hz. After 5s
//		the ADuC831 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 ADuC831 will wake up and continue 
//		blinking as before for 5s before entering power down
//		mode again.
//
//********************************************************************

#include <stdio.h> 
#include <ADuC831.h>

sbit LED = 0x0B4;

void DELAY(int);


void int0 () interrupt 0
{		                                                         
}

void TIC_int () interrupt 10
{		                                                         
}

void main (void)
{
	int i;
	IEIP2 = 0xA4;
    IT0 = 1;
    EX0 = 1;
	EA = 1; 

	while(1)
	{ 
   		for(i=0;i<50;i++)
		{
		DELAY(8400);
		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 + -