/*********************************
串口 0 中断函数
*********************************/
void serial_0(void)interrupt 4
{
unsigned char a;
if(RI)
{ // bgo=1;
a=SBUF;
ucRxBuf[uiRxCount]=a;
RI=0;
//send_byte(ucRxBuf[uiRxCount]);
uiRxCount++;
uiRxCount%=RXBUFSIZE;
}
}
/*********************************
串口 1 中断函数
*********************************/
void serial_1(void)interrupt 7
{
char a;
if(RI_1)
{
a=SBUF1;
ucRxBuf1[uiRxCount1]=a;
RI_1=0;
//send_byte(ucRxBuf1[uiRxCount1]);
uiRxCount1++;
uiRxCount1%=RXBUFSIZE;
}
}
中断函数中尽量少做工作,以保证中断的及时性。
//INT2中断 由P1.4引脚产生
void int_2(void)interrupt 8
{
//xdata uchar str[8];
//static uchar a;
//a++;
//FT2=1;
EXIF=EXIF&0xef;
//sprintf(str,"n=%d\n",a);
//send_bytes(str);
rsdog();
birq2=1;
}
//-------------------------------------------------------------------
需要源程序,请在网站留言栏留下E-mail.