用的是STM8L151K6单片机 发现定时器不能中断,代码如下 extern @far @interrupt void time2_IRQHandler(void); struct interrupt_vector const _vectab[] = { {0x82, (interrupt_handler_t)main}, /* 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, time2_IRQHandler}, /* 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 */ }; @far @interrupt void time2_IRQHandler(void) { RCRST_1; TIM2_SR1 &= ~0x01; //清除中断标记 RTC_FLOW_FLAG = 1; return; } void sys_ini(void) { unsigned char i; CLK_ICKCR |= 0X01; //打开内部HSI时钟 while(!(CLK_ICKCR & 0X02)); //等待内部时钟稳定 CLK_CKDIVR = 0x12; //0x1a; // CLK_CSSR = 0X00; TIM2_IER = 0X00; //先禁止中断 TIM2_EGR = 0X01; //允许产生更新事件 TIM2_PSCR = 0X04; TIM2_ARRH = RTCH_SET; //设置定时 TIM2_ARRL = RTCL_SET; TIM2_CNTRH = RTCH_SET; TIM2_CNTRL = RTCL_SET; TIM2_CR1 |= 0X81; //开启定时器时间初始值 TIM2_IER |= 0X01; //允许更新中断 _asm("rim"); //允许CPU全局中断 } 已经搞了一个星期了,真的要崩溃了。是我的技术太菜了吗?确实是刚接触STM。哎!请高手指点一下啊 extern @far @interrupt void time2_IRQHandler(void);有声明的,这个声明在STM_INTERRUUT_VECTOR.C中 会不会是单片机质量有问题或者烧录器有问题啊,用的是ST-LINK/V2 |
STMS005K6T6 如何采集内部参考电压。
stm8s003 adc中断和通道切换的问题
adc施密特触发器stm8
stm8l051f3 TSSOP20 封装,待机模式下,2天后,电流突然增加到140UA
STM8S用STVP烧录怎么加密?
如何使用ST官网例程_LIN总线通讯_STM8AF
STM8 LIN
IAR代码编辑太费劲了,想问一下有没有好的方法,试了VScode但是头文件老是报错,调了很久也没调好,想换个方法了。
想问一下各位大佬,IAR下载调试代码时出现 warning: is an illegal data sample expression IAR是什么意思啊?
STM8S标准库TIM1编码器功能不计数,请大师帮我看看
time2中断向量不对吧,你程序里是13,数据手册里是19。s系列T2溢出中断向量是13,L系列T2溢出中断向量是19,希望能帮到你!