如下代码,
#define RELOAD_COUNT 0xd9 //12.000MHz,12T,SMOD=0,9600bps
void serial_port_one_initial()
{
SCON = 0x50; //0101,0000 8位可变波特率,无奇偶校验位
// TMOD = 0x21; //0011,0001 设置顶时器1为8位自动重装计数器
// TH1 = RELOAD_COUNT; //设置定时器1自动重装数
// TL1 = RELOAD_COUNT;
// TR1 = 1; //开定时器1
BRT = RELOAD_COUNT;
// BRTR = 1, S1BRS = 1, EXTRAM = 1 ENABLE EXTRAM
//AUXR = 0x11; // T0x12,T1x12,UART_M0x6,BRTR,S2SMOD,BRTx12,EXTRAM,S1BRS
AUXR = 0x15; //For 12MHz OSC
ES = 1; //允许串口中断
EA = 1; //开总中断
}
RELOAD_COUNT的值是怎么算出来的 |