完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
我尝试使用刺激来触发PIC18F26K40的TMR1中断,但我无法设法让中断触发。这就是我所尝试的:tiCKI上的时钟刺激:这似乎成功地使TMR1递增,但是从来没有触发过中断。使用PIR4.TMR1IF上的PIN/寄存器操作使其被设置为每500ms一个“1”。这设置PIR4.TMR1IF为真,但仍然从来没有触发过中断句柄。代码中的r方法。我不太确定此时应该如何尝试和模拟TMR1中断。如果有人有任何建议,或者可以指给我一个有效的教程/刺激计划,那将是非常感谢的。预先感谢。
以上来自于百度翻译 以下为原文 I am attempting to use Stimulus to trigger a TMR1 interrupt for a PIC18F26K40 and I cannot manage to get the interrupt to trigger. This is what I have tried:
Thanks in advance. |
|
相关推荐
4个回答
|
|
|
如果你展示你的代码,你会更容易帮助。你设置了TMR1IE、PEIE和GIE吗?
以上来自于百度翻译 以下为原文 It would be easier to help if you showed your code. Have you set TMR1IE, PEIE and GIE ? |
|
|
|
|
|
我已经使用MCC来为我生成配置代码。在我的主要功能中,我启用了中断:它涵盖了我相信的各个GIE和PEI比特。PIC18F26K40的文档表示,GIL和PEI位在ITCCON寄存器中是相同的位。在THETMR1X初始化方法中,下面的代码运行:这似乎覆盖了TMR1IE标志。简而言之,我认为我已经正确地启用了中断和TMR1,并且可以使用一个指针。正确的方向。目前我的项目只是一个为PIC18F26K40创建的香草MCC项目;如果你愿意,易于复制。
以上来自于百度翻译 以下为原文 I have used the MCC to generate configuration code for me. In my main function I have enabled interrupts: // Enable high priority global interrupts INTERRUPT_GlobalInterruptHighEnable(); // Enable low priority global interrupts. INTERRUPT_GlobalInterruptLowEnable();That covers the respective GIE and PEIE bits I believe. The documentation for the PIC18F26K40 says that the GIEL and PEIE bits are the same bit in the INTCON register. In the TMR1_Initialize method the following code is run: // Clearing IF flag before enabling the interrupt. PIR4bits.TMR1IF = 0; // Enabling TMR1 interrupt. PIE4bits.TMR1IE = 1;This seems to cover the TMR1IE flag. In short, I think that I have properly enabled interrupts and TMR1 and could use a pointer in the right direction. At the moment my project is just a vanilla MCC project created for the PIC18F26K40; easy to reproduce if you want to. |
|
|
|
|
|
我用MPLAB X V3.45尝试TMR1中断,它工作。请尝试使用“INTCONbits.PEIE=1;”和“INTCONbits.GIE=1;”代替MCC来生成配置代码,以查看TMR1中断是否工作。如果更改有效,请在使用MCC生成配置代码时再次检查INTCON值。
以上来自于百度翻译 以下为原文 I try the TMR1 interrupt with MPLAB X v3.45 and it works. Please try to use "INTCONbits.PEIE = 1;" and "INTCONbits.GIE = 1;" instead of the MCC to generate configuration code to see whether TMR1 interrupt works or not. If the change works, please double check what the INTCON value is when you use the MCC to generate configuration code. |
|
|
|
|
|
看起来,不管我做什么,直接设置INTCON位,或者使用MCC生成的代码,我仍然没有得到触发的中断。我一定是做错了什么,还不能肯定。我在这里附上了截图:http://imgur.com/a/pyaI1
以上来自于百度翻译 以下为原文 It seems like, no matter what I do, setting the INTCON bits directly or using the MCC generated code, I still get no triggered interrupt. I must be doing something wrong, not sure what yet. I've attached a screenshot here: http://imgur.com/a/pyaI1 |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
473 浏览 0 评论
5793 浏览 9 评论
2334 浏览 8 评论
2224 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3530 浏览 3 评论
1121浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1095浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
872浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
473浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-1 19:29 , Processed in 0.621413 second(s), Total 78, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
2244