📄 interrup.c
字号:
#include "config.h"
#include "io.h"
#include <intrins.h>
#include "global.h"
/*
函数 定时器0中断处理程序,定时器0每125us中断一次
*/
void timer0(void) interrupt 1
{
if ((++timer0cnt & 0x07) == 0)
{
pollintack = 1;
}
if (timer0cnt == 200)
{
++_25msCount;
timer0cnt = 0;
}
}
/*
函数 定时器1中断处理程序,定时器1用于马达的控制
*/
void timer1(void) interrupt 3 using 1
{
}
/*
函数 定时器2中断处理程序,定时器2用于产生波特率,应该没有中断
*/
void timer2(void) interrupt 5
{
}
/*
函数 串口中断
*/
void serial(void) interrupt 4
{
if (RI)
{
RI = 0;
if (RxBusy == 0)
{
RxBuffer[RxCount] = SBUF;
RxTimeout = 10;
RxCount = (RxCount+1) % sizeof(RxBuffer);
}
}
if (TI)
{
TI = 0;
if (TxRead == TxWrite)
{
TxEmpty = 1;
}
else
{
SBUF = TxBuffer[TxRead];
TxRead = (TxRead + 1) & 0x0f;
}
}
}
/*
函数 外部中断0处理程序,无中断
*/
void ext_int0(void) interrupt 0
{
}
/*
函数 外部中断0处理程序,无中断
*/
void ext_int1(void) interrupt 2
{
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -