我正在研究嵌入式处理器,并且无法在实际中获取中断。他们在模拟中工作得很好,但这是另一回事。无法理解此功能extern void _setvect1(int vector,_Interrupt1 void(* target)());
反正这个ARC处理器设置中断处理程序使用此功能_setvect1看起来像这样
extern void _setvect1(int vector, _Interrupt1 void (*target)());
我不明白的第二部分是什么意思,什么它寻找。这是一个指向函数的指针,我不习惯看到类似(* target)的东西我依稀记得()是一个函数吗?
这就是我的ISR
int volatile flag_sp3 = 0;
_Interrupt1 _Save_all_regs void sp3_isr(void)
{
unsigned volatile long result;
result = _lr(0x0A);//status maybe
display_value(result);
flag_sp3++;
}
他们叫中断1和_Save_all_regs调用约定,另一件事我不是真的碰上了。我正在与他们的支持交谈,但仍然试图为自己理解和解决问题。
这是一个函数指针,看看我的代码,看看它是如何使用= >> http://stackoverflow.com/questions/32614150/clarification-on-function-pointers-in-c/32615240 #32615240 – Michi
坏主意在一个中断内调用display_value()。强烈建议将值保存到全局变量,然后一些主线函数查找flag_sp3变量中的更改,并在更改时调用display_value() – user3629249