你好:
程序作用是利用串口助手输入数据,中断接收后再通过串口打印出来。接收和发送我放在了sciNotification函数中。
程序运行时始终不进入中断处理。麻烦各位高手看看是程序或者hal中哪里出了问题,谢谢。
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
一个关于SCI的程序供你参考吧.
仔细看中断处理中的这段代码:
case 11U:
/* receive */
byte = (uint8)(scilinREG->RD & 0x000000FFU);
if (g_sciTransfer_t.rx_length > 0U)
{
*g_sciTransfer_t.rx_data = byte;
/*SAFETYMCUSW 567 S MR:17.1,17.4 <APPROVED> "Pointer increment needed" */
g_sciTransfer_t.rx_data++;
g_sciTransfer_t.rx_length--;
if (g_sciTransfer_t.rx_length == 0U)
{
sciNotification(scilinREG, (uint32)SCI_RX_INT);
}
}
break;
如果g_sciTransfer_t.rx_length不初始化为非0的话,sciNotification根本进不去。
一般在调用sciReceive的时候会初始化rx_length,但是你的程序中没有调用这个函数,也没有初始化rx_length。
不知道你的linLowLevelInterrupt中断能不能进?