您好!
我已经看到、硬故障中断位于 interrupt.h 内(至少在通用电机控制项目中)。 因此、当在运行时某种程度上发生硬故障时、它会跳到那里而不执行任何操作。 因此、由于 interrupt.h 是一个库和唯一的参考、我不想修改此文件、并且我的问题是、如何在电机在此 ISR 内挂起之前注册自己的回调来关闭电机? 我从其他制造商那里知道、他们只有弱 ISR 例程、然后我可以定义自己的例程来轻松解决该问题。
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.
您好!
我已经看到、硬故障中断位于 interrupt.h 内(至少在通用电机控制项目中)。 因此、当在运行时某种程度上发生硬故障时、它会跳到那里而不执行任何操作。 因此、由于 interrupt.h 是一个库和唯一的参考、我不想修改此文件、并且我的问题是、如何在电机在此 ISR 内挂起之前注册自己的回调来关闭电机? 我从其他制造商那里知道、他们只有弱 ISR 例程、然后我可以定义自己的例程来轻松解决该问题。
尊敬的 Sebastian:
您可以浏览一下与您的问题类似的帖子吗?
谢谢。
嘉兴市
你好、这并不是我的问题。 我的问题非常具体、关于通用电机控制 SDK 示例。
这些用作 driverlib 中的 interrupt.h 的驱动程序。 任何硬故障都将导致 ISR 跳转至 interrupt.h 内的特定例程
由于该库仅用作示例中的参考、因此如果不对特性进行大量修改、我就无法直接访问这些回调。
整个项目。
以下是 interrupt.h 中的 Interrupt_DefaultHandler 的示例:
//*****************************************************************************
//
//! \internal
//! The default interrupt handler.
//!
//! This is the default interrupt handler. The Interrupt_initVectorTable()
//! function sets all vectors to this function. Also, when an interrupt is
//! unregistered using the Interrupt_unregister() function, this handler takes
//! its place. This should never be called during normal operation.
//!
//! The ESTOP0 statement is for debug purposes only. Remove and replace with an
//! appropriate error handling routine for your program.
//!
//! \return None.
//
//*****************************************************************************
static void Interrupt_defaultHandler(void)
{
uint16_t pieVect;
uint16_t vectID;
//
// Calculate the vector ID. If the vector is in the lower PIE, it's the
// offset of the vector that was fetched (bits 7:1 of PIECTRL.PIEVECT)
// divided by two.
//
pieVect = HWREGH(PIECTRL_BASE + PIE_O_CTRL);
vectID = (pieVect & 0xFEU) >> 1U;
//
// If the vector is in the upper PIE, the vector ID is 128 or higher.
//
if(pieVect >= 0x0E00U)
{
vectID += 128U;
}
//
// Something has gone wrong. An interrupt without a proper registered
// handler function has occurred. To help you debug the issue, local
// variable vectID contains the vector ID of the interrupt that occurred.
//
ESTOP0;
for(;;)
{
;
}
}
其中指出 ESTOP 仅用于调试、应替换为错误处理例程。
那么、我能够以某种方式简单地针对应用程序中的任何硬故障注册错误回调、还是我真的需要
来修改 interrupt.h?