哪位有TC下 串口共享中断接收例程呀,给发下谢了。
#define NO_INT 0x01
#define URS_ID 0x06
#define RX_ID 0x04
#define FDT_ID 0x0c
#define TBRE_ID 0x02
#define HSR_ID 0x0
#define RX_MASK 0x0f
//com1中断服务程序
void far interrupt Com1Int(__CPPARGS)
{
unsigned char Status = 0;
char Loop = 0;
while(Loop == 0)
{
Status = inportb(COM1BASEADDR + IIR) & RX_MASK;
switch(Status)
{
case NO_INT:
Last1Status = 1;
break;
case URS_ID:
inportb(COM1BASEADDR + LSR); //撤销中断
Last1Status = 2;
break;
case RX_ID: //未用fifo时处理例子
if (((Com1RevEndBuf + 1) &(SBUFSIZ - 1)) == Com1RevStartBuf)
S1Error = BUFOVFL;
Com1RevBuf[Com1RevEndBuf++] = inportb(COM1BASEADDR + RXR);//如果使用fifo必须读至激活状态
Com1RevEndBuf &= SBUFSIZ - 1;
Last1Status = 3;
break;
case FDT_ID:
inportb(COM1BASEADDR + RXR); //撤销中断
Last1Status = 4;
break;
case TBRE_ID:
#ifdef INT_SEND
if(Com1SendStartBuf != Com1SendEndBuf)
{
outportb(COM1BASEADDR + TXR,Com1SendBuf[Com1SendStartBuf++]);
}
Com1SendStartBuf &= SBUFSIZ - 1;
#endif
Last1Status = 5;
break;
case HSR_ID:
inportb(COM1BASEADDR + MSR); //撤销中断
Last1Status = 6;
break;
default:
Last1Status = 7;
break;
}
if((Last1Status == 1) || (Last1Status == 7)) break;
}
outportb(ICR, EOI); /*中断应答*/
}
这些不知道能不能帮上你。