1.硬件
2.软件
#include "reg52.h"
#include "intrins.h"
sfr AUXR = 0x8E;
void UartInit(void)
{
AUXR = 0x1;
SCON = 0x40;
TMOD &= 0x0F;
TMOD |= 0x20;
TH1 = 0xFD;
TL1 = 0xFD;
TR1 = 1;
}
void Delay1000ms()
{
unsigned char i, j, k;
_nop_();
i = 8;
j = 1;
k = 243;
do
{
do
{
while (--k);
} while (--j);
} while (--i);
}
void main()
{
char data_msg = 'a';
UartInit();
while(1){
Delay1000ms();
SBUF = data_msg;
}
}
#include "reg52.h"
#include "intrins.h"
sfr AUXR = 0x8E;
void UartInit(void)
{
AUXR = 0x01;
SCON = 0x40;
TMOD &= 0x0F;
TMOD |= 0x20;