sfr SFRPI = 0xAC;
sfr SCFG = 0x9A;
sfr S1BRT = 0x9A;
#define SCON_PAGE0 0x00
#define SCON_PAGE1 0x01
#define SCFG_PAGE0 0x00
#define S1BRT_PAGE1 0x01
#define SBUF_PAGE1 0x01
void v_uart1_init(void)
{
SFRPI = SCFG_PAGE0; //page0
SCFG = 0x14; //S1TR = 1,S1TX12 = 1
SFRPI = S1BRT_PAGE1;
S1BRT = 0xEC; //256-20
SFRPI = SCON_PAGE1;
SCON = 0x40; //mode 1 8-bit uart
ES = 1; |