我的MSCAN的收数和发数都已经没问题了,数据完全正确,但是现在有个问题,就是如果我的CAN的插座不接上,程序就会跑死,出不来了,我单步走发现是进了一个中断里
/*
** ===================================================================
** Method : Cpu_Interrupt (bean MC9S12C32_80)
**
** Description :
** This method is internal. It is used by Processor Expert
** only.
** ===================================================================
*/
#pragma CODE_SEG __NEAR_SEG NON_BANKED /* Interrupt section for this module. Placement will be in NON_BANKED area. */
还有一个问题,就是我的CAN数据的接受和发送都用的是中断,设断点我发现接受可以进中断,而发送却进不了中断
#pragma CODE_SEG __NEAR_SEG NON_BANKED /* Interrupt section for this module. Placement will be in NON_BANKED area. */
__interrupt void CAN1_FreeTxBuffer(void)
{
byte buffer = CANTFLG & 7; /* Temporary variable */
__EI(); /* If yes then enable interrupts */
CAN1_OnFreeTxBuffer(buffer); /* If yes then invoke user event */
}
#pragma CODE_SEG CAN1_CODE /* Code section for this module. */
/*
** ===================================================================
** Method : CAN1_FullRxBuffer (bean MotorolaCAN)
**
** Description :
** This method is internal. It is used by Processor Expert
** only.
** ===================================================================
*/
#pragma CODE_SEG __NEAR_SEG NON_BANKED /* Interrupt section for this module. Placement will be in NON_BANKED area. */
__interrupt void CAN1_FullRxBuffer(void)
{
CAN1_OnFullRxBuffer(); /* If yes then invoke user event */
CANRFLG_RXF = 1; /* Reset the reception complete flag */
}
#pragma CODE_SEG CAN1_CODE /* Code section for this module. */
/*
** ===================================================================
** Method : CAN1_Error (bean MotorolaCAN)
**
** Description :
** This method is internal. It is used by Processor Expert
** only.
** ===================================================================
*/
#pragma CODE_SEG __NEAR_SEG NON_BANKED /* Interrupt section for this module. Placement will be in NON_BANKED area. */
__interrupt void CAN1_Error(void)
{
if (CANRFLG_TSTAT == 3) { /* Is busoff detect? */
CAN1_OnBusOff(); /* If yes then invoke user event */
}
CANRFLG |= 254; /* Reset error flags */
}
#pragma CODE_SEG CAN1_CODE /* Code section for this module. */
请问是怎么回事,代码有问题吗?