// Version: VER1.0
// Date: 2014-11-28
// Remark:
//========================================================================
void PrintString1(u8 *puts) //send a string
{
for (; *puts != 0; puts++) //End with stop 0
{
TX1_write2buff(*puts);
}
}
//========================================================================
// Function: void UART1_config(void)
// Description: UART1 initialization function.
// Parameters:none.
// Return: none.
// Version: VER1.0
// Date: 2014-11-28
// Remark:
//========================================================================
void UART1_config(void)
{
TR1 = 0;
AUXR &= ~0x01; //S1 BRT Use Timer1;
AUXR |= (1<<6); //Timer1 set as 1T mode
TMOD &= ~(1<<6); //Timer1 set As Timer
TMOD &= ~0x30; //Timer1_16bitAutoReload;
TH1 = (u8)((65536L-(MAIN_Fosc / 4) / Baudrate1) >> 8);
TL1 = (u8)(65536L-(MAIN_Fosc / 4) / Baudrate1);
ET1 = 0; // Disable Timer1 interrupt
INT_CLKO &= ~0x02; // Timer1 does not output high-speed clock
TR1 = 1; // Start Timer1
S1_USE_P30P31(); P3n_standard(0x03); //Switch to P3.0 P3.1
//S1_USE_P36P37(); P3n_standard(0xc0); //Switch to P3.6 P3.7
//S1_USE_P16P17(); P1n_standard(0xc0); //Switch to P1.6 P1.7
SCON = (SCON & 0x3f) | 0x40; //UART1 mode, 0x00: synchronized shift output,
// 0x40: 8-bit data, variable baud rate,
// 0x80: 9-bit data, fixed baud rate,
// 0xc0: 9-bit data, variable baud rate
// PS = 1; //high priority interrupt
ES = 1; //enable interrupt
REN = 1; //enable receiving
B_TX1_Busy = 0;
}
//========================================================================
// Function: void UART1_int (void) interrupt UART1_VECTOR
// Description: UART1 interrupt function
// Parameters:nine.
// Return: none.
// Version: VER1.0
// Date: 2014-11-28
// Remark:
//========================================================================