Timer0_Delay(38400,1,1000); 定时器零在38.4Khz主频下延时1毫秒,是这样吗?有详细的中文库函数说明吗?
ML51_BSP_C51_V1.00\SampleCode\StdDriver\UART2例程中无法使用,注释掉 //Timer0_Delay(38400,1,1000); UART2就可以发送了
代码如下:
MFP_P21_UART2_TXD;
P21_QUASI_MODE;
set_SC0CR0_SCEN; /* Enable SC module */
set_SC0CR1_UARTEN; /* set as UART mode */
set_SC0CR1_CLKKEEP;
clr_SC0CR0_CONSEL; /* clr CONSEL and AUTOCEN*/
clr_SC0CR0_AUTOCEN;
SC0ETURD0 = 0x07; /* define baud rate low byte */
SC0ETURD1 = 0x00; /* define baud rate high byte */
set_SC0CR1_PBOFF; //parity bit disable
SC0CR1&=0XCF; //datalegth 8bit
set_SC0CR0_NSB; //stop bit = 1bit
//下列几行代码什么含义?
SFRS =1;
TA=0xAA;
TA=0x55;
LVRDIS = 0x5A;
TA=0xAA;
TA=0x55;
LVRDIS = 0xA5;
TA=0xAA;
TA=0x55;
PORDIS = 0x5A;
TA=0xAA;
TA=0x55;
PORDIS = 0xA5;
FsysSelect(FSYS_LIRC);
set_PCON_LPR;
while(1)
{
UART_Send_Data(UART2,0x50);
//Timer0_Delay(38400,1,1000);
} |