[技术问答] 用mini54串口,只开启接收中断却不能使用?求帮助

[复制链接]
2798|4
 楼主| 电子好学者 发表于 2014-4-7 17:10 | 显示全部楼层 |阅读模式
使用mini54串口功能做上位机,我只要接收中断但是不用发送缓冲区空中断 ,我按照例程和寄存器介绍配置,但是没有开启发送缓冲区空中断串口使用就不正常,开启的话 就可以实现双向通信,不知道为什么?有人用过求帮助呀!
haolaishi 发表于 2014-4-7 22:24 | 显示全部楼层
看看你的程序。。。
 楼主| 电子好学者 发表于 2014-4-8 21:49 | 显示全部楼层
haolaishi 发表于 2014-4-7 22:24
看看你的程序。。。

我那个就是例程的呀 只是去掉发送空中断
 楼主| 电子好学者 发表于 2014-4-8 21:52 | 显示全部楼层
haolaishi 发表于 2014-4-7 22:24
看看你的程序。。。

void UART_TEST_HANDLE()
{
    uint8_t u8InChar=0xFF;
    uint32_t u32IntSts= UART->ISR;

    if(u32IntSts & UART_ISR_RDA_INT_Msk)
    {
        
        
        /* Get all the input characters */
        while(UART_IS_RX_READY(UART))
        {
            /* Get the character from UART Buffer */
            u8InChar = UART_READ(UART);           /* Rx trigger level is 1 byte*/   

            
            
            if(u8InChar == '0')   
            {   
                g_bWait = FALSE;
            }
        
            /* Check if buffer full */
            if(g_u32comRbytes < RXBUFSIZE)
            {
                /* Enqueue the character */
                g_u8RecData[g_u32comRtail] = u8InChar;
                g_u32comRtail = (g_u32comRtail == (RXBUFSIZE-1)) ? 0 : (g_u32comRtail+1);
                g_u32comRbytes++;
            }           
        }
        
    }

   
        uint16_t tmp;
        tmp = g_u32comRtail;
        if(g_u32comRhead != tmp)
        {
            u8InChar = g_u8RecData[g_u32comRhead];
            UART_WRITE(UART,u8InChar);
            、、有个等待发送完成吧
            g_u32comRhead = (g_u32comRhead == (RXBUFSIZE-1)) ? 0 : (g_u32comRhead+1);
            g_u32comRbytes--;
        }
    }
}
骗子的片子 发表于 2014-4-8 22:05 | 显示全部楼层
发送缓冲是必须的吧
您需要登录后才可以回帖 登录 | 注册

本版积分规则

34

主题

119

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部