timer1.c
来自「周立功arm7(lpc2104)的工程模板」· C语言 代码 · 共 56 行
C
56 行
// *********************************
// LPC22XX SYSTEM WITHOUT OS
// FILE: TIMER.C
// MODIFIED: ZY 2007-5-31 8:30
// *********************************
#include "lpc22xx.h"
#include "main.h"
#include "vic.h"
#include "config.h"
#include "timer1.h"
extern unsigned int counter;
extern unsigned char gao;
extern unsigned char high;
extern unsigned char low;
void isr_timer0(void)
{
gao = ((counter >> 16 ) & 0x000000ff);
// gao = 0xaa;
UART0_SendByte(gao);
high = ((counter >> 8 ) & 0x000000ff);
// high = 0xff;
UART0_SendByte(high);
low =(counter & 0x000000ff);
// low = 0xaa;
UART0_SendByte(low);
counter = 0;
T0IR = 0x01;
}
void timer0_init(void) { // Install timer 0
vect_irq_install(VIC_CH_TIMER0, VIC_SLOT_TIMER0, isr_timer0);
T0IR = 0xff;
T0TC = 0x00;
T0MCR = 0x03;
T0MR0 = 12000000;
T0TCR = 0x01;
VIC_INT_ENABLE(VIC_CH_TIMER0);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?