c8051f350串口通信(2)
发布时间:2021-06-07
发布时间:2021-06-07
串口通信
{
unsigned int n;
n = 0;
while(n<m){
n++;
}
return;
}
//-----------------------------------------------------------------------------
// 主程序
//-----------------------------------------------------------------------------
void main (void)
{
PCA0MD &= ~0x40; // 禁止看门狗
ReceiveBit = 0;
Byte = 0;
PORT_Init(); // 初始化端口I/O
SYSCLK_Init(); // 初始化系统时钟
UART0_Init(); // 串口初始化
EA = 1;
ES0 = 1;
while(1){
if(TX_Ready == 1 && UART_Buffer_Size != 0 && Byte == 13)
{
TX_Ready = 0; // Set the flag to zero
TI0 = 1; // Set transmit flag to 1
/*if(ReceiveBit == 1)
{
SBUF0 = temp;
ReceiveBit = 0;
}*/
}
WDTE=0