📄 timertrig1.c
字号:
/*********************************************************************
Author : ADI - Apps www.analog.com/MicroConverter
Date : Sept. 2005
File : TimerTrig1.c
Hardware : Applicable to ADuC702x rev H or I silicon
Currently targetting ADuC7026.
Description : Demonstrates Timer 1 causing an interrupt and complements
P4.2 every 50ms.
*********************************************************************/
#include<ADuC7026.h>
void My_IRQ_Function(void);
int main (void) {
T1LD = 0x20000; // Counter Value
T1CON = 0xC4; // Enabled,Periodic,Binary and CLK/16
IRQ = My_IRQ_Function; // Specify Interrupt Service Rountine
IRQEN = GP_TIMER_BIT; // Enable Timer1 IRQ
GP4DAT = 0x04000000; // P4.2 configured as an output. LED is turned on
while (1)
{
}
}
/********************************************************************/
/* */
/* Interrupt Service Rountine */
/* */
/********************************************************************/
void My_IRQ_Function()
{
if ((IRQSTA & GP_TIMER_BIT) != 0) // Timer1 IRQ?
{
GP4DAT ^= 0x00040000; // Complement P4.2
T1CLRI = 0; // Clear Timer IRQ
}
return ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -