怎么对不可写的寄存器进行写操作会有不同的效果?
[复制链接]
一个51单片机的程序,对外部AD寄存器读写
void AD_Write_Reg( char tx_buff)
{
U0DBUF=tx_buff; // Write byte to USART0 buffer (transmit data)
while(U0CSR&0x01); // Check if byte is transmitted (and a byte is recieved)
U0CSR &= ~0x01; // Clear transmit byte status
}
这个U0CSR最后一位datasheet上最后一位是ACTIVE;
ACTIVE / R /USART transmit/receive active status. In SPI slave mode, this bit equals slave select.
0: USART idle
1: USART busy in transmit or receive mode
显示只能进行读操作呀,怎么还有U0CSR &= ~0x01;这条程序?
我把这条删除了,程序就不出结果了。
如果换成一个1ms或1us的延时,也没结果~
求解
|