timer.c

来自「ARM7(LPC2131) + FreeRTOS, 基于 Codesourcer」· C语言 代码 · 共 26 行

C
26
字号
/******************************************************************************/
/*  TIMER.C: Time Functions for 10Hz Clock Tick using Timer0                  */
/******************************************************************************/
/*  Inspired by a sample application from Keil Elektronik                     */
/*  A lot of information has been found in a sample from R O Software.        */
/******************************************************************************/
/*  Sample for WinARM by M.Thomas <eversmith@heizung-thomas.de>               */
/******************************************************************************/

#include "lpc213_4x.h"
#include "..\app\FreeRTOSconfig.h"
#include "Timer.h"

#define TxIR_MR0_FLAG        (1<<0)

volatile unsigned long timeval;

/* Timer1 Compare-Match Interrupt Handler (ISR) */
void __attribute__ ((interrupt("IRQ"))) tc1_cmp(void) 
{
	timeval++;
	T1IR = TxIR_MR0_FLAG; // Clear interrupt flag by writing 1 to Bit 0
	VICVectAddr = 0;       // Acknowledge Interrupt (rough?)
}

⌨️ 快捷键说明

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