完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
HII…我试图写两个ISR例程在16F628 A…一个比较器中断和其他串行中断。两个作品都是独立完成的。但是,只要我试图与这两个中断工作…没有中断是工作…任何人可以引导通过它吗?
以上来自于百度翻译 以下为原文 Hii .. I am trying to write two ISRs routine in 16f628a ..One for comparator interrupt & other for serial interrupt. Both works fine independently. But as long as i am trying to work with both interrupt...none of interrupt is working...can anyone please guide through it? |
|
相关推荐
14个回答
|
|
你可以只有一个IR程序与该PIC,因为只有一个IR向量!在例程中,你必须测试,然后红外源是什么引起的…
以上来自于百度翻译 以下为原文 You can have only one IR routine with that PIC, because there is only one IR vector! Inside the routine you have to test then which source the IR caused... void interrupt isr(void) { // if (interrupt_1_enabled && interupt_1_flagged){ // interrupt_1_flag = 0; // ... // return; // } // if (interrupt_2_enabled && interupt_2_flagged){ // interrupt_2_flag = 0; // ... // return; // } // ... while(1){;} // (detect unexpected IR sources) } |
|
|
|
|
|
|
|
注意,如果您有时禁用该中断源,则只需要“中断Twitter启用和安培”测试。如果您从未禁用中断,则可以自行测试“中断”标记。
以上来自于百度翻译 以下为原文 Note, the "interrupt_#_enabled &&" test is only required if you sometimes disable that interrupt source. You can test just the "interrupt_#_flagged" bit by itself if you never disable the interrupt. |
|
|
|
这是我正在做的一个项目的真实例子。
以上来自于百度翻译 以下为原文 This is a real example from a project i am working on /* for PIC 18F46K20 & XC8 & using MCC */ void interrupt INTERRUPT_InterruptManager (void) { // interrupt handler if(INTCONbits.PEIE == 1 && PIE1bits.TX1IE == 1 && PIR1bits.TX1IF == 1) { EUSART_Transmit_ISR(); } else if(INTCONbits.PEIE == 1 && PIE1bits.RC1IE == 1 && PIR1bits.RC1IF == 1) { EUSART_Receive_ISR(); } else if(INTCONbits.PEIE == 1 && PIE2bits.BCLIE == 1 && PIR2bits.BCLIF == 1) { I2C_BusCollisionISR(); } else if(INTCONbits.PEIE == 1 && PIE1bits.SSPIE == 1 && PIR1bits.SSPIF == 1) { I2C_ISR(); } else { //Unhandled Interrupt } } void I2C_ISR(void) { // code } etc. |
|
|
|
阿尔伯特61,你有没有清除过比特?如果没有,这些额外的测试会给你的ISR增加额外的延迟。
以上来自于百度翻译 以下为原文 AlbertH61, do you ever clear the PEIE bit? If not, those extra tests are adding extra latency to your ISR. |
|
|
|
是的,它是由MCC或类似的代码产生的——“过度保护”。
以上来自于百度翻译 以下为原文 yeah, it's code Generated from MCC or alike that creates those - "over-protective" |
|
|
|
不,我没有清除PEIT位。这段代码是由MCC生成的,不是由我生成的,它看起来很好。但我没有优化延迟的ISR时序。再次查看此代码,我同意“ItNCONTITS PEI= 1”是由所有语句测试的,因此可以被移动一个更高的级别或完全删除。问题仍然是,为什么MCC将这个测试添加到代码中?还有其他原因让MCC写下来吗?
以上来自于百度翻译 以下为原文 No, I do not clear the PEIE bit. This piece of code was generated by the MCC and not by me, it seems to work fine. But I have not optimized the ISR timings for latencies. Looking again at this code I agree that "INTCONbits.PEIE == 1" is tested by all statements and could therefore be moved one level higher or removed completely. The question remains then, why MCC adds this test to the code? Is there another reason to keep it in and write it the way MCC writes it ? |
|
|
|
他们试图精确地模拟硬件,但是如果比特永远不会被清除,那就毫无意义了。同样,如果总是设置,测试IE位是没有意义的。每一个额外的测试都会使中断服务慢一点。
以上来自于百度翻译 以下为原文 They are trying to exactly emulate the hardware, but it's pointless if the bit is never cleared. Equally, testing the IE bits is pointless if they are always set. Every extra test slows your interrupt service down a little more. |
|
|
|
IMO,它是一个带有MCC的bug:HTTP//www. McCHIP.COM/FUMMS/FUNDSPE/944
以上来自于百度翻译 以下为原文 IMO, it is a bug with MCC: http://www.microchip.com/forums/FindPost/944659 |
|
|
|
串行中断与终端工作良好,但只要我与SIM800接口,我无法触发。可能的bug是什么?我尝试过不同的拖延。串行中断在PIC和终端之间很好,但不是SIM800,任何人都可以通过它来引导。
以上来自于百度翻译 以下为原文 Serial interrupt works fine with terminal but as long as i interface with sim800, I am unable to trigger. What could be the possible bug? I have tried with different delays. Serial interrupt works excellent between pic and terminal but not with sim800...can anyone please guide through it. |
|
|
|
|
|
|
|
因为这可能是一个不同的话题-&继续这里:HTTP://www. McCHIP.COM/FUMMS/M100982.ASPX
以上来自于百度翻译 以下为原文 |
|
|
|
HII RODIMS……PIC和SIM800之间的接口很好。我都能用SIM800做消息和调用…我的问题是每当我在代码中引入串行中断…我不能做呼叫和消息,而串行中断在PC终端和我的控制器之间也很好。
以上来自于百度翻译 以下为原文 hii rodims.... Interface between pic and sim800 is fine.. I am all able to do messages and calls with sim800...My question is whenever i am introducing serial interrupt in my code.. i am not able to do calls and messages, While serial interrupt also works fine between PC terminal & my controller. |
|
|
|
听起来你在代码中犯了一个错误。我们需要看到你的真实代码来帮助你找到它。
以上来自于百度翻译 以下为原文 It sounds like you made a mistake in your code. We need to see your real code to try to help you find it. |
|
|
|
只有小组成员才能发言,加入小组>>
5248 浏览 9 评论
2036 浏览 8 评论
1956 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3217 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2264 浏览 5 评论
786浏览 1评论
677浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
603浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
684浏览 0评论
581浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-27 04:58 , Processed in 1.462693 second(s), Total 104, Slave 88 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号