打印
[STM8]

STM8AF中断问题

[复制链接]
5655|5
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
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.

使用特权

评论回复
5
汉之云| | 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);

使用特权

评论回复
6
win2000_li|  楼主 | 2009-6-29 14:56 | 只看该作者

谢谢,指点。

谢谢。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

142

主题

718

帖子

1

粉丝