完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
尽管INTCON.GIE在ISR中被设定为0岁。中断仍然是永恒的。发生了什么事?谢谢=)
以上来自于百度翻译 以下为原文 Despite INTCON.GIE being set to 0 in the ISR. The interrupt still fires forever. What is going on? Thanks =) void toggle(void) { PORTAbits.RA2 = 0; for (uint16_t i = 0; i < 100; i++); PORTAbits.RA2 = 1; for (uint16_t i = 0; i < 100; i++); } void main(void) { while (!OSCSTAT1bits.HFOR); PIR0bits.TMR0IF = 0; T0CON1bits.T0CS1 = 1; T0CON1bits.T0CKPS2 = 1; T0CON1bits.T0CKPS0 = 1; T0CON0bits.T0EN = 1; PIE0bits.TMR0IE = 1; // LED TRISAbits.TRISA2 = 0; INTCONbits.PEIE = 1; INTCONbits.GIE = 1; for(;;); } void interrupt ISR(void) { if(PIR0bits.TMR0IF) { toggle(); PIR0bits.TMR0IF = 0; INTCONbits.GIE = 0; } } |
|
相关推荐
6个回答
|
|
|
|
|
|
|
|
|
你不应该在ISR中与GIE搞糟。硬件关闭ISR条目上的中断,并将它们在ReFiE上打开。你试图将GIOOF关闭是硬件的阻碍。如果你想关掉计时器中断,那就关掉它。
以上来自于百度翻译 以下为原文 You shouldn't mess with GIE in the ISR. The hardware turns off interrupts on ISR entry and turns them back on at RETFIE. Your attempt to turn GIE off is thwarted by the hardware. If you want to turn off the timer interrupt, then just turn that off. |
|
|
|
|
|
也可以写入到LATX而不是PORTXON不执行ISR的延迟
以上来自于百度翻译 以下为原文 Also: write to LATx not PORTx don't execute delays from ISR |
|
|
|
|
|
然而,如果编译器认为它们什么也不做,并将它们进行优化,那么这些延迟实际上不会做任何事情。苏珊
以上来自于百度翻译 以下为原文 ...however those delays may not actually be doing anything if the compiler sees they achieve nothing and optimises them away. Susan |
|
|
|
|
|
+1,OP应该读取PIC16F18366数据表中的“中断”一章,特别是在第97页上标记为“8.1操作”的列。
以上来自于百度翻译 以下为原文 +1 The OP should have a read of the "Interrupt" chapter in the PIC16F18346 datasheet, particularly the column labelled "8.1 Operation" on page 97. i.e. change INTCONbits.GIE = 0; to PIE0bits.TMR0IE = 0; // disable TMR0 interrupts |
|
|
|
|
|
写到LATX而不是PORTX:写LATX和PORTX背后的原理是什么?有关于这方面的文档吗?
以上来自于百度翻译 以下为原文 write to LATx not PORTx What is the rationale behind writing to LATx versus PORTx? Is there documentation you can point to about this ? |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
473 浏览 0 评论
5793 浏览 9 评论
2334 浏览 8 评论
2224 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3530 浏览 3 评论
1124浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1097浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
873浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
475浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 08:45 , Processed in 0.768730 second(s), Total 54, Slave 47 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
1407