📄 intr.c
字号:
/*
项目: 人员定位:读卡器
文件: intr.c
日期: 2007.09.12
作者: 邵子扬
说明: 中断处理,这个文件处理所有与中断相关的函数(不包括初始化)。
*/
#include <avr/io.h>
#include <avr/interrupt.h>
#include "common.h"
SIGNAL(SIG_INTERRUPT0)
{
return;
}
//外部中断1
//nRF2401接收到数据后产生
SIGNAL(SIG_INTERRUPT1)
{
DataReady = 1;
return;
}
uint8 cnt = 0;
SIGNAL(SIG_OUTPUT_COMPARE2A)
{
cnt++;
if(cnt >= 125)
{
cnt = 0;
tmr.sec++;
if(tmr.sec >= 60)
{
tmr.sec = 0;
tmr.min++;
if(tmr.min >= 60)
{
tmr.min = 0;
tmr.hour++;
if(tmr.hour >= 24)
{
tmr.hour = 0;
tmr.day++;
if(tmr.day >= 32)
tmr.day = 0;
}
}
}
}
return;
}
SIGNAL(SIG_OUTPUT_COMPARE1A)
{
return;
}
//串口接收中断
SIGNAL(SIG_USART_RECV)
{
DataReceive(uart_read());
}
//串口发送中断
SIGNAL(SIG_USART_TRANS)
{
if(RTptr >= RTlen)
{
//关闭发送使能
PORTREG(RS485PORT) &= ~(1 << RS485TXEn);
RTflag = 0; //设置为接收状态
RTptr = 0;
}
else
{
uart_write(RTBuf[RTptr]);
RTptr++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -