/****************变量和函数定义*********************************/ #define scibandrate 9600 void SCI_INIT1(void); void SCI_INIT2(void); void delay(int x); uchar buff1=0x22;void main(void) { SCI_INIT1(); EnableInterrupts; /* enable interrupts */ for(;;) {
} } void SCI_INIT1(void) { SCI1BD =4000000/16/scibandrate; //设置波特率 SCI1C1=0x00; SCI1C2=0xAC;//使能接受中断 } interrupt 17 void SCI1_RE(void) { PTAD=0X01; while(SCI1S1_RDRF) buff1=SCI1D; SCI1S1_RDRF=0;
} interrupt 18 void SCI1_TR(void) { PTAD=0X02; while(SCI1S1_TDRE) SCI1D=buff1; //SCI1S1_TDRE=0;
}
[此贴子已经被作者于2008-10-13 18:56:53编辑过] |