[STM8] STM8AF中断问题

[复制链接]
 楼主| win2000_li 发表于 2009-6-29 11:35 | 显示全部楼层 |阅读模式
在中断向量表不知道怎么设置???

请高手指点。

我用了TIME4做时基,周期性中断。

但是在中断设置时,发生错误:

#error cpstm8 stm8_interrupt_vector.c:48(8+23) invalid pointer initializer


向量表程序如下:

struct interrupt_vector const _vectab[] = {
    {0x82, (interrupt_handler_t)_stext}, /* reset */
    {0x82, NonHandledInterrupt}, /* trap  */
    {0x82, NonHandledInterrupt}, /* irq0  */
    {0x82, NonHandledInterrupt}, /* irq1  */
    {0x82, NonHandledInterrupt}, /* irq2  */
    {0x82, NonHandledInterrupt}, /* irq3  */
    {0x82, NonHandledInterrupt}, /* irq4  */
    {0x82, NonHandledInterrupt}, /* irq5  */
    {0x82, NonHandledInterrupt}, /* irq6  */
    {0x82, NonHandledInterrupt}, /* irq7  */
    {0x82, NonHandledInterrupt}, /* irq8  */
    {0x82, NonHandledInterrupt}, /* irq9  */
    {0x82, NonHandledInterrupt}, /* irq10 */
    {0x82, NonHandledInterrupt}, /* irq11 */
    {0x82, NonHandledInterrupt}, /* irq12 */
    {0x82, NonHandledInterrupt}, /* irq13 */
    {0x82, NonHandledInterrupt}, /* irq14 */
    {0x82, NonHandledInterrupt}, /* irq15 */
    {0x82, NonHandledInterrupt}, /* irq16 */
    {0x82, NonHandledInterrupt}, /* irq17 */
    {0x82, NonHandledInterrupt}, /* irq18 */
    {0x82, NonHandledInterrupt}, /* irq19 */
    {0x82, NonHandledInterrupt}, /* irq20 */
    {0x82, NonHandledInterrupt}, /* irq21 */
    {0x82, NonHandledInterrupt}, /* irq22 */
    {0x82, TIM4_UPD_OVF_IRQHandler}, /* irq23 */
    {0x82, NonHandledInterrupt}, /* irq24 */
    {0x82, NonHandledInterrupt}, /* irq25 */
    {0x82, NonHandledInterrupt}, /* irq26 */
    {0x82, NonHandledInterrupt}, /* irq27 */
    {0x82, NonHandledInterrupt}, /* irq28 */
    {0x82, NonHandledInterrupt}, /* irq29 */
 楼主| win2000_li 发表于 2009-6-29 11:43 | 显示全部楼层

这里是中断服务函数!!!

@near @interrupt void TIM4_UPD_OVF_IRQHandler (void)
{
  /* In order to detect unexpected events during development,
     it is recommended to set a breakpoint on the following instruction.
  */
    
  return;
}
汉之云 发表于 2009-6-29 11:43 | 显示全部楼层

看看区别

{0x82, (interrupt_handler_t)_stext}, /* reset */
{0x82, TIM4_UPD_OVF_IRQHandler}, /* irq23 */
 楼主| win2000_li 发表于 2009-6-29 13:05 | 显示全部楼层

您的意思是说

0x82, (TIM4_UPD_OVF_IRQHandler)_stext}, /* irq23 */

不对头,我编译了。通不过啊!!!

#error cpstm8 stm8_interrupt_vector.c:48(32) invalid pointer initializer
#error cpstm8 stm8_interrupt_vector.c:55(1) missing }
#error cpstm8 stm8_interrupt_vector.c:48(9+23) TIM4_UPD_OVF_IRQHandler undefined
stm8_interrupt_vector.c:
 The command: "cxstm8 -itime4 +mods0 +debug -pxp -pp -l -ilibraryinc -i"C:Program FilesCOSMICCXSTM8_16KHstm8" -iE:V101_TestSystemprogram -iE:V101_TestSystemprogramlibraryinc  -clDebug -coDebug stm8_interrupt_vector.c" has failed, the returned value is: 1
exit code=1.
汉之云 发表于 2009-6-29 13:28 | 显示全部楼层

....

我是说该这样:
{0x82, (interrupt_handler_t)_stext}, /* reset */
{0x82, (interrupt_handler_t)TIM4_UPD_OVF_IRQHandler}, /* irq23 */

当然,要在文件开始出声明一下:
void TIM4_UPD_OVF_IRQHandler(void);
 楼主| win2000_li 发表于 2009-6-29 14:56 | 显示全部楼层

谢谢,指点。

谢谢。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

142

主题

718

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部