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

📄 pdown.c

📁 8051试验程序 基础教材
💻 C
字号:
//********************************************************************
//
// Author        : ADI - Apps            www.analog.com/MicroConverter
//
// Date          : November 2001
//
// File          : PDown.c
//
// Hardware      : ADuC836
//
// Description   : Demonstrates a use of a timer interval counter to
//		wake the ADuC836 out of Power down mode after a user
//		specified Power down time.
//
//		The LED will, on power up, flash at 10Hz. After 5s
//		the ADuC836 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 ADuC836 will wake up and continue
//		blinking as before for 5s before entering power down
//		mode again.
//
//********************************************************************

#include <stdio.h>
#include <ioADuC836.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,j;
	IEIP2 = 0xA4;
    TCON_bit.IT0 = 1;
    IE_bit.EX0 = 1;
	IE_bit.EA = 1;
	INTVAL = 0x14;


	while(1)
	{
   		for (i = 0; i < 50; i++)
			{
			for (j = 0; j < 10000; j++)
				{
		        	LED ^= 1;
				}        	
			}

			TIMECON = 0x13;
        	LED = 0;
        	PCON = 0x22;

        	TIMECON = 0x12;
	}
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -