牛卧堂MCU技术交流
标题:
N76E003能进入UART中断,但测不到波形是怎么回事
[打印本页]
作者:
firefly2k
时间:
2017-4-17 19:24
标题:
N76E003能进入UART中断,但测不到波形是怎么回事
如题,N76E003能进入UART中断,但测不到波形是怎么回事?请大侠指导!
我发送一个字符,或多个字符都能成功进入中断,但测量TX就是没波形(RX我也测了,因为芯片有RX/TX交换的功能)
程序如下:
void SerialPort0_ISR(void) interrupt 4
{
if(TI==1)
{
clr_TI; /* if emission occur */
}
}
void main (void)
{
CKSWT = 0;
CKEN = 0x20;
CKDIV = 0;
AUXR1 = 0;
P0 = 0xff;
P0M1 = 0x27;
P0M2 = 0x18;
P0S = 0xff;
P0SR = 0;
IE =0x10;
IP =4;
IPH =2;
EIP =4;
EIPH=4;
EIP1=0;
EIPH1=0;
TCON=4;
TMOD = 0x20;
TH1 = 256 - (1000000/9600+1);
TR1 = 1;
SCON = 0x50;
set_SMOD; //UART0 Double Rate Enable
set_T1M; //Sys clock no divider
clr_BRCK; //select Timer1
TI =0;
EA =1;
SBUF = 0xa5;
while(1);
}
作者:
a_ziliu
时间:
2017-4-19 15:13
在bsp中的例子,N76E003_BSP_Keil_C51_V1.0.1\Sample_Code\UART1
不要開中斷試試
void Send_Data_To_UART1 (UINT8 c)
{
TI_1 = 0;
SBUF_1 = c;
while(TI_1==0);
}
欢迎光临 牛卧堂MCU技术交流 (http://nuvoton-mcu.com/)
Powered by Discuz! X3.2