在研究PIC16F73单片机串口通信中,在其异步串行模式下,发现手册上写着:
Flag bit RCIF is a read only bit which is cleared by the hardware.It is cleared when the RCREG register has been read and is empty.The RCREG is a double buffered register(i.e.,it is a two deep FIFO).It is possible for two bytes of data to be received and transferred to the RCREG FIFO.
应该大致说一旦读取了RCREG寄存器就清除了RCIF的状态,现有几点不太清楚:
1.由于RCREG寄存器是个两字节的寄存器,是不是只有接受了两字节数据RCIF标志位才会被置1?假如上位机只发送0xfe会置位RCIF么?
2.如果RCREG未满的情况下读取RCREG是不是也会清空RCIF的值?
3.按此情况检测到RCREG==1时,应该连续取两次才是清空RCREG的值,
unchar UCD0=RCREG
unchar UCD1=RCREG
这样子的话哪个数据数据是先发送的?(难道跟大小端模式有关?)
还望各位不吝赐教~
|