?? 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 + -