嵌入式学习小组
直播中

万物死

8年用户 1271经验值
擅长:MEMS/传感技术
私信 关注

nuc240 uart1可以传送但不能接收怎么解决?

我是個初學者, 學範例改程式, 由 PC 端用 RS232 通訊, 根據測試 NUC240 傳送沒問題,


卻無法收到訊息, 不知為何, 懇請各方前輩高手不吝幫忙,  謝謝:


以下是我改的程式:

#include
#include "NUC230_240.h"

#define PLLCON_SETtiNG      SYSCLK_PLLCON_50MHz_XTAL
#define PLL_CLOCK           50000000

void UART1_Init()
{
    /* Reset IP */
    SYS_ResetModule(UART1_RST);

    /* Configure UART1 and set UART1 Baudrate */
    UART_Open(UART1, 115200);
}

int32_t main(void)
{  

    unsigned char  gChar;

    uint32_t  u32Count, u32delayno;


    UART1_Init();
    u32delayno = 0;
     while(uart->FSR & UART_FSR_RX_EMPTY_Msk)  {
            u32delayno++;
            if(u32delayno >= 0x40000000)
                continue;
     }
     gChar = uart->RBR;  //程式無法到此段落, 取得 PC  端傳來的字元 !


}





更多回帖

发帖
×
20
完善资料,
赚取积分