[STM8] 请教STM8中断向量问题

[复制链接]
 楼主| 电星电器 发表于 2011-11-25 10:02 | 显示全部楼层 |阅读模式
struct interrupt_vector const _vectab[] = {
    {0x82, (interrupt_handler_t)_stext}, /* reset */
    {0x82, NonHandledInterrupt}, /* trap  */
    {0x82, TLI_Interrupt},       /* 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}, /* 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, NonHandledInterrupt}, /* irq23 */
    {0x82, NonHandledInterrupt}, /* irq24 */
    {0x82, NonHandledInterrupt}, /* irq25 */
    {0x82, NonHandledInterrupt}, /* irq26 */
    {0x82, NonHandledInterrupt}, /* irq27 */
    {0x82, NonHandledInterrupt}, /* irq28 */
    {0x82, NonHandledInterrupt}, /* irq29 */
请高手指教,怎么个写法,我怎么写TLI怎么写都会报错了 郁闷不解中,
香水城 发表于 2011-11-25 10:15 | 显示全部楼层
问报错的原因时,一定要说报的是什么错!!
 楼主| 电星电器 发表于 2011-11-25 11:23 | 显示全部楼层

错误

错误
就是这个错误
香水城 发表于 2011-11-25 13:32 | 显示全部楼层
错误信息显示的不是很清楚吗?

符号 ...... 没有定义
 楼主| 电星电器 发表于 2011-11-25 13:47 | 显示全部楼层
/* BASIC INTERRUPT VECTOR TABLE FOR STM8 devices
* Copyright (c) 2007 STMicroelectronics
*/
typedef void @far (*interrupt_handler_t)(void);
struct interrupt_vector {
unsigned char interrupt_instruction;
interrupt_handler_t interrupt_handler;
};
@far @interrupt void NonHandledInterrupt (void)
{
/* in order to detect unexpected events during development,
    it is recommended to set a breakpoint on the following instruction
*/
return;
}
extern void _stext();     /* startup routine */
@far @interrupt void TLI_Interrupt(void);
@far @interrupt void TIM3_UPD_OVF_IRQHandler(void);
@far @interrupt void TIM4_UPD_OVF_IRQHandler(void);


struct interrupt_vector const _vectab[] = {
{0x82, (interrupt_handler_t)_stext}, /* reset */
{0x82, NonHandledInterrupt}, /* trap  */
{0x82, TLI_Interrupt}, /* 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, TIM3_UPD_OVF_IRQHandler}, /* 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 */
};
我是这么写的 TIME3和TIME4就不会报错,就是TLI会 ,我不知道是那里有问题了啊 ,版主可以给我写个例子吗,谢谢了
香水城 发表于 2011-11-25 14:08 | 显示全部楼层
ST的库里面有大量例程,不必我再给你写例子了吧?
 楼主| 电星电器 发表于 2011-11-25 16:11 | 显示全部楼层
版主我还是没有搞明白为什么  怎么写都要报错,你能不能在我上传的程序帮我修改下我错误的地方啊,非常感谢,求救啊!
香水城 发表于 2011-11-25 16:22 | 显示全部楼层
你的void TLI_Interrupt(void); 在哪里?
 楼主| 电星电器 发表于 2011-11-25 16:40 | 显示全部楼层
我也刚刚才发现 真是太粗心了 谢谢版主了,
Cortex-M0 发表于 2011-11-26 05:58 | 显示全部楼层
太太粗心了~~~  :lol
丑奴儿atl 发表于 2011-11-30 14:44 | 显示全部楼层
这错误不应该啊:lol
ltel2105 发表于 2015-4-25 14:46 | 显示全部楼层
电星电器 发表于 2011-11-25 13:47
/* BASIC INTERRUPT VECTOR TABLE FOR STM8 devices
* Copyright (c) 2007 STMicroelectronics
*/

谢谢
598330983 发表于 2015-4-25 22:34 | 显示全部楼层
怎么写都会报错了 郁闷不解中
734774645 发表于 2015-4-25 23:45 | 显示全部楼层
符号 ...... 没有定义
yun_xiao 发表于 2015-9-10 19:52 | 显示全部楼层
我也碰到过这个问题
qgmfly 发表于 2015-9-18 16:26 | 显示全部楼层

这不就是没有申明吗? 你在包含头文件的语句加面加一行 : extern @far @interrupt void TLI_Interrupt(void);
您需要登录后才可以回帖 登录 | 注册

本版积分规则

3

主题

134

帖子

1

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

3

主题

134

帖子

1

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