- UID
- 163493
- 性别
- 男
|
#include /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
unsigned char temp=0;
unsigned char rxdata=0;
void main(void) {
unsigned char temp,rxdata ;
/* enable interrupts */
/* include your code here */
temp=0;
rxdata=0;
CONFIG1=0X39;
CONFIG2=0X00;
SCBR=0X04;
SCC1=0X53;
SCC2=0X2C;
SCC3=0;
SCC2_SCTIE=0;
EnableInterrupts;
for(; ;) ;
}
/*接收中断子程序*/
interrupt void SCIRx(void) {
temp=SCS1;
rxdata=SCDR;
SCC2_SCTIE=1;
}
/*发送中断子程序*/
interrupt void SXITx(void) {
temp=SCS1;
SCDR=rxdata;
SCC2_SCTIE=0;
}
这是一个SCI接收中断的程序,这里的FOR为什么要死循环???如果不要的话,程序就出错了!!这样就能达到接收中断的效果吗??请大家帮我看看.我不太明白!!!!
谢谢了!!!
|
|