应该采用3楼的写法,但注意软件的bug
while((ReSendStatusR &(1<<SendTestBit))== 0);//等待SCI中断设置SendTestBit位
ReSendDataR=o;//通知允许发送数据.
俺认为应该加: ReSendStatusR &=~ (1<<SendTestBit);//清除SCI中断标志位SendTestBit
否则可能会出现重复发送的现象.
这个程序应该是双标志,所以在执行任务时ReSendDataR也要做相应的处理.
有时可能还要开关中断.
完整的应该: while((ReSendStatusR &(1<<SendTestBit))== 0);//等待SCI中断设置SendTestBit位
ReSendStatusR &=~ (1<<SendTestBit);//清除SCI中断标志位SendTestBit ReSendDataR=o;//通知允许发送数据.
....... ReSendDataR=...;
|
|