PWM module does not want to access the custom interrupt routine but always jumps to the default rout

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

PWM module does not want to access the custom interrupt routine but always jumps to the default rout

跳至解决方案
1,187 次查看
fi_schi_
Contributor I

Hi there,

I am working with the FRDM-MCXA153 board.
I´m trying to get an interruot on every rising edge using the standart PWM example portet to c++.
So far so simpe, bit unfortunately the interrupt always wants to jump tot the standart interrupt routine (declared as WEAK) and ignores my self-written one.

The PWM module is configured via ConfigTools -> Peripherals -> FLEXPWM0 and should generate an interrupt at VAL2.

Thanks in advance for your help.

标签 (1)
0 项奖励
回复
1 解答
1,177 次查看
snech99
Contributor I

Hi,

if your main-file is written in c++, you need to add extern "C" before your ISR.

Following is a short text I found in the startup file:

 

//*****************************************************************************

// Forward declaration of the core exception handlers.

// When the application defines a handler (with the same name), this will

// automatically take precedence over these weak definitions.

// If your application is a C++ one, then any interrupt handlers defined

// in C++ files within in your main application will need to have C linkage

// rather than C++ linkage. To do this, make sure that you are using extern "C"

// { .... } around the interrupt handler within your main application code.

//*****************************************************************************

 

在原帖中查看解决方案

0 项奖励
回复
1 回复
1,178 次查看
snech99
Contributor I

Hi,

if your main-file is written in c++, you need to add extern "C" before your ISR.

Following is a short text I found in the startup file:

 

//*****************************************************************************

// Forward declaration of the core exception handlers.

// When the application defines a handler (with the same name), this will

// automatically take precedence over these weak definitions.

// If your application is a C++ one, then any interrupt handlers defined

// in C++ files within in your main application will need to have C linkage

// rather than C++ linkage. To do this, make sure that you are using extern "C"

// { .... } around the interrupt handler within your main application code.

//*****************************************************************************

 

0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-1885121%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EPWM%E6%A8%A1%E5%9D%97%E4%B8%8D%E6%83%B3%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E4%B8%AD%E6%96%AD%E7%A8%8B%E5%BA%8F%EF%BC%8C%E4%BD%86%E6%80%BB%E6%98%AF%E8%B7%B3%E8%BD%AC%E5%88%B0%E9%BB%98%E8%AE%A4%E7%A8%8B%E5%BA%8F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1885121%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%E6%82%A8%E5%A5%BD%EF%BC%8C%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%E6%88%91%E6%AD%A3%E5%9C%A8%E4%BD%BF%E7%94%A8%20FRDM-MCXA153%20%E6%9D%BF%E3%80%82%3CBR%20%2F%3E%E6%88%91%E6%AD%A3%E5%9C%A8%E5%B0%9D%E8%AF%95%E4%BD%BF%E7%94%A8%E6%A0%87%E5%87%86%20PWM%20%E7%A4%BA%E4%BE%8B%20portet%20%E5%88%B0%20c%2B%2B%20%E5%9C%A8%E6%AF%8F%E4%B8%AA%E4%B8%8A%E5%8D%87%E6%B2%BF%E8%8E%B7%E5%8F%96%E4%B8%80%E4%B8%AA%E4%B8%AD%E6%96%AD%E3%80%82%3CBR%20%2F%3E%E5%88%B0%E7%9B%AE%E5%89%8D%E4%B8%BA%E6%AD%A2%E9%83%BD%E5%BE%88%E7%AE%80%E5%8D%95%EF%BC%8C%E4%BD%86%E4%B8%8D%E5%B9%B8%E7%9A%84%E6%98%AF%EF%BC%8C%E4%B8%AD%E6%96%AD%E6%80%BB%E6%98%AF%E6%83%B3%E8%B7%B3%E8%BD%AC%E5%88%B0%E6%A0%87%E5%87%86%E4%B8%AD%E6%96%AD%E4%BE%8B%E7%A8%8B%EF%BC%88%E5%A3%B0%E6%98%8E%E4%B8%BA%20WEAK%EF%BC%89%E5%B9%B6%E5%BF%BD%E7%95%A5%E6%88%91%E8%87%AA%E5%B7%B1%E7%BC%96%E5%86%99%E7%9A%84%E4%B8%AD%E6%96%AD%E4%BE%8B%E7%A8%8B%E3%80%82%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EPWM%20%E6%A8%A1%E5%9D%97%E9%80%9A%E8%BF%87%20ConfigTools%20-%26gt%3B%20Peripherals%20-%26gt%3B%20FLEXPWM0%20%E9%85%8D%E7%BD%AE%EF%BC%8C%E5%B9%B6%E5%BA%94%E5%9C%A8%20VAL2%20%E5%A4%84%E4%BA%A7%E7%94%9F%E4%B8%AD%E6%96%AD%E3%80%82%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%E6%8F%90%E5%89%8D%E6%84%9F%E8%B0%A2%E6%82%A8%E7%9A%84%E5%B8%AE%E5%8A%A9%E3%80%82%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1885121%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EMCXA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1885175%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9APWM%20%E6%A8%A1%E5%9D%97%E4%B8%8D%E6%83%B3%E8%AE%BF%E9%97%AE%E8%87%AA%E5%AE%9A%E4%B9%89%E4%B8%AD%E6%96%AD%E7%A8%8B%E5%BA%8F%EF%BC%8C%E4%BD%86%E6%80%BB%E6%98%AF%E8%B7%B3%E8%BD%AC%E5%88%B0%E9%BB%98%E8%AE%A4%E4%B8%AD%E6%96%AD%E7%A8%8B%E5%BA%8F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1885175%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%E5%A6%82%E6%9E%9C%E6%82%A8%E7%9A%84%E4%B8%BB%E6%96%87%E4%BB%B6%E6%98%AF%E7%94%A8%20c%2B%2B%20%E7%BC%96%E5%86%99%E7%9A%84%EF%BC%8C%E5%88%99%E9%9C%80%E8%A6%81%E5%9C%A8%20ISR%20%E4%B9%8B%E5%89%8D%E6%B7%BB%E5%8A%A0%20extern%20%22C%22%E3%80%82%3C%2FP%3E%3CP%3E%E4%BB%A5%E4%B8%8B%E6%98%AF%E6%88%91%E5%9C%A8%E5%90%AF%E5%8A%A8%E6%96%87%E4%BB%B6%E4%B8%AD%E6%89%BE%E5%88%B0%E7%9A%84%E4%B8%80%E6%AE%B5%E7%AE%80%E7%9F%AD%E7%9A%84%E6%96%87%E5%AD%97%EF%BC%9A%3C%2FP%3E%3CBR%20%2F%3E%3CDIV%3E%3CDIV%3E%3CP%3E%3CSPAN%3E%2F%2F*****************************************************************************%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%2F%2F%20%E6%A0%B8%E5%BF%83%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86%E7%A8%8B%E5%BA%8F%E7%9A%84%E5%89%8D%E5%90%91%E5%A3%B0%E6%98%8E%E3%80%82%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%2F%2F%20%E5%BD%93%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E5%AE%9A%E4%B9%89%E4%B8%80%E4%B8%AA%E5%A4%84%E7%90%86%E7%A8%8B%E5%BA%8F%EF%BC%88%E5%85%B7%E6%9C%89%E7%9B%B8%E5%90%8C%E7%9A%84%E5%90%8D%E7%A7%B0%EF%BC%89%E6%97%B6%EF%BC%8C%E8%BF%99%E5%B0%86%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%2F%2F%20%E8%87%AA%E5%8A%A8%E4%BC%98%E5%85%88%E4%BA%8E%E8%BF%99%E4%BA%9B%E5%BC%B1%E5%AE%9A%E4%B9%89%E3%80%82%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%2F%2F%20%E5%A6%82%E6%9E%9C%E6%82%A8%E7%9A%84%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E6%98%AF%20C%2B%2B%20%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%EF%BC%8C%E5%88%99%E4%BB%BB%E4%BD%95%E5%AE%9A%E4%B9%89%E7%9A%84%E4%B8%AD%E6%96%AD%E5%A4%84%E7%90%86%E7%A8%8B%E5%BA%8F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%2F%2F%20%E4%B8%BB%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E4%B8%AD%E7%9A%84%20C%2B%2B%20%E6%96%87%E4%BB%B6%E9%9C%80%E8%A6%81%E6%9C%89%20C%20%E9%93%BE%E6%8E%A5%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%2F%2F%20%E8%80%8C%E4%B8%8D%E6%98%AF%20C%2B%2B%20%E9%93%BE%E6%8E%A5%E3%80%82%E4%B8%BA%E6%AD%A4%EF%BC%8C%E8%AF%B7%E7%A1%AE%E4%BF%9D%E4%BD%BF%E7%94%A8%3C%2FSPAN%3E%3CSPAN%3Eextern%3C%2FSPAN%3E%20%3CSPAN%3E%22C%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%2F%2F%20%E4%B8%BB%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E4%BB%A3%E7%A0%81%E4%B8%AD%E7%9A%84%E4%B8%AD%E6%96%AD%E5%A4%84%E7%90%86%E7%A8%8B%E5%BA%8F%E5%91%A8%E5%9B%B4%E6%9C%89%20%7B%20....%20%7D%E3%80%82%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%2F%2F*****************************************************************************%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E