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.
請問一下 CAN_getInterruptCause() 跟 CAN_getInterruptMessageSource()
兩者有甚麼差別??
CAN_getInterruptCause() 是說可以知道CAN中斷的原因,甚麼原因?
getInterruptMessageSource() 是說可以知道CAN中斷 interrupt message source.,message source是指CAN_L receive 的 訊息嗎?
你好,CAN_getInterruptCause() 应该是通过读取CAN中断状态以查找中断源,一般函数都会有介绍,如以下
uint32_t status; // Read the CAN-B interrupt status (in the CAN_INT register) to find the // cause of the interrupt status = CAN_getInterruptCause(CANB_BASE); // If the cause is a controller status interrupt, then get the status. // During first iteration of every ISR execution, status = 0x8000, // which simply means CAN_ES != 0x07. if(status == CAN_INT_INT0ID_STATUS) { // Read the controller status. This will return a field of status // error bits that can indicate various errors. Error processing // is not done in this example for simplicity. Refer to the // API documentation for details about the error status bits. // The act of reading this status will clear the interrupt. // status = CAN_getStatus(CANB_BASE); // Return CAN_ES value. // Now status = 0x00000010, indicating RxOK. // Check to see if an error occurred. if(((status & ~(CAN_STATUS_RXOK)) != CAN_STATUS_LEC_MSK) && ((status & ~(CAN_STATUS_RXOK)) != CAN_STATUS_LEC_NONE)) { // Set a flag to indicate some errors may have occurred. errorFlag = 1; glblStatus = status; } }
方便给一下这两个函数的出处吗?