📄 interrupt.c
字号:
#include <REGX52.H>
#include "temp.h"
#include "tty.h"
#include <stdio.h>
bit receive_flag;
bit sendflg;
bit bufflag;
uchar bdata channelbit;
uchar idata rsbuf[2][10];
// uchar idata ssbuf[10];
idata uint channeldata[8];
void ex0Interrupt(void);
void timer0Interrupt(void);
void ex1Interrupt(void);
void timer1Interrupt(void);
void recivedata(void);
void senddata(void);
void timer2interrupt(void);
void timer0Interrupt(void) interrupt 1 using 3
{
static uchar channel=0x00;
TR2=0;
TR0 =0;
TL0=0;
TH0=0;
if(channelbit)
{
channeldata[channel++]=timer2;
timer2=0;
while(!(channelbit&(0x01<<channel)))
{
channel++;
if(channel==8)
channel=0;
}
PORT=(channel<<4)|0x0f;
//TR0=1;
TR2=1;
}
else channel=0x00;
TR0=1;
}
/*void recivedata(void) //串行收数据中断函数
{
static uchar count=0;
char cdata;
}
void senddata(void)
{
static uchar count=0;
uchar c;
if(sendflg)
{
c = ssbuf[count++];
SBUF = c;
if(c=='\0'||c=='\n'||c=='\r')
{
count = 0;
sendflg=0;
}
}
}*/
/*void serial (void) interrupt 4 using 2
{
char c;
static uchar rcount=0,scount=0;
if(RI)
{
RI=0;
//recivedata();
c = SBUF;
if(c=='\0'||c=='\n'||c=='\r')
{
rcount=0;
receive_flag=1;
return;
}
if(bufflag)
rsbuf[1][rcount++] = c;
else
rsbuf[0][rcount++] = c;
}
if(TI)
{
TI=0;
if(sendflg)
{
c = ssbuf[scount++];
SBUF = c;
if(c=='\0'||c=='\n'||c=='\r')
{
scount = 0;
sendflg=0;
}
}
}
}
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -