打印
[STM8]

[STM8]STM8L152C6中断问题

[复制链接]
1500|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
磁轨炮|  楼主 | 2014-9-15 09:45 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 磁轨** 于 2014-9-15 10:00 编辑

小弟初学STM8,在设置中断编译的时候出现
#error cpstm8 stm8_interrupt_vector.c:19(31) redeclared external USART1_RX_IRQn

求高手指点,纠结在这很久了

函数声明:
extern void USART1_RX_IRQn(void);


中断函数

@far @interrupt void USART1_RX_IRQn(void)
{        
        u8 temp=0;
        if(USART_GetITStatus(USART1,USART_IT_RXNE)!=RESET)
        {        
                USART_ClearITPendingBit (USART1,USART_IT_RXNE);
                USART_SendData8(USART1,USART_ReceiveData8(USART1));
                while(USART_GetFlagStatus(USART1,USART_FLAG_TXE)==RESET);
               
        }
        return;
}

向量表:
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, NonHandledInterrupt}, /* irq23 */
        {0x82, NonHandledInterrupt}, /* irq24 */
        {0x82, NonHandledInterrupt}, /* irq25 */
        {0x82, NonHandledInterrupt}, /* irq26 */
        {0x82, NonHandledInterrupt}, /* irq27 */
        {0x82, (interrupt_handler_t)USART1_RX_IRQn}, /* irq28 */
        {0x82, NonHandledInterrupt}, /* irq29 */
};

谢谢各位大神了
沙发
磁轨炮|  楼主 | 2014-9-15 11:56 | 只看该作者
自顶

使用特权

评论回复
板凳
mmuuss586| | 2014-9-15 12:14 | 只看该作者
参考库程序好了
USART.rar (40.42 KB)

使用特权

评论回复
评分
参与人数 1威望 +1 收起 理由
磁轨炮 + 1 赞一个!
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

13

主题

38

帖子

0

粉丝