TI中文支持网
TI专业的中文技术问题咨询交流网站

F280049C CAN function 功能

請問一下 CAN_getInterruptCause() 跟 CAN_getInterruptMessageSource()

兩者有甚麼差別??

CAN_getInterruptCause() 是說可以知道CAN中斷的原因,甚麼原因?

getInterruptMessageSource() 是說可以知道CAN中斷 interrupt message source.,message source是指CAN_L receive 的 訊息嗎?

Green Deng:

你好,CAN_getInterruptCause() 应该是通过读取CAN中断状态以查找中断源,一般函数都会有介绍,如以下

uint32_t status;// Read the CAN-B interrupt status (in the CAN_INT register) to find the// cause of the interruptstatus = 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;}}

方便给一下这两个函数的出处吗?

123 1232:

回复 Green Deng:

赞(0)
未经允许不得转载:TI中文支持网 » F280049C CAN function 功能
分享到: 更多 (0)