完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我在XC8上在PIC18F26K22上调试这个ISR,代码执行使这个奇怪的跳跃。整个周末我都在看这个奇怪的行为,我仍然死死地坚持。尝试我能想到的一切。当我调试附加的代码(REF.PNG文件)时,完全执行。奇怪的跳跃。在示例PNG文件中,代码执行从第172行跳到第203行,这完全没有意义。当我重新调整ISR并改变中断处理程序的顺序时,它仍然在不同的位置进行滑稽跳转。我使用以下设置:-PIC18F26K22-MPLAPX3.60(最新)-XC8 1.42(最新)-PICtiT3i多次编译该项目,多次改写ISR,但没有成功。所以这不是问题。然后我创建了一个新的清洁项目,并把代码复制到那个新项目中,没有成功。重新启动了很多次,升级到最新版本,把PICTIT3换成了另一个。现在我陷入了困境。发生了什么事?我想在周末之前完成这个更新,我一直在努力的是这个垃圾。有人吗?
以上来自于百度翻译 以下为原文 Hi, I am debugging this ISR in XC8 on a PIC18F26k22 and the code execution makes this really weird jump. All weekend I am looking at this strange behavior and I am still dead stuck. Tried everything that I could think of. When I am debugging the attached code (ref .PNG file) execution makes completely weird jumps. In the example PNG file the code execution jumps from line 172 to line 203 and that makes no sense at all. When I reshuffle the ISR and change the order of the interrupt handlers then it still makes funny jumps at different locations. I am using the following setup: - PIC 18F26k22 - MPLAPX 3.60 (latest) - XC8 1.42 (latest) - PICKit3 I have recompiled the project many times and reshuffled the ISR many times without success. The code only gives 3 warnings about functions that are never called. So that can not be the issue. Then I created a new clean project and copied the code to that new project, without success. Rebooted many times, Upgraded to latest versions, Swapped the PICKit3 for another one. And now I am stuck... What is going on? I wanted to have this update done by the end of the weekend and all I have been struggling with is this crap. Anyone, please? Attached Image(s) |
|
相关推荐
4个回答
|
|
嗨,你使用的是低优先级和高优先级吗?在调试时,你看到这个问题了吗?程序在调试时崩溃/停止吗?你有几个中断活动吗?你有时会禁用其中的一个(或几个)吗?如果是的话,你必须使用下面的每个中断标志测试)如果(In2IF and & and;It2IE)……(如果XXXIF和……,XXXXY)…请显示整个中断代码OTER,它只是猜测……
以上来自于百度翻译 以下为原文 Hi, Are you using both low and high priority ? Do you see this issue while debugging ? Does the program crash/stop while debugging ? Do you have several interrupts active ? Do you sometimes disable one (or several) of them ? If so you must use the following for EACH interrupt flag test) if (INT2IF && INT2IE) ... if (xxxxIF && xxxxIE) .... Please show you entire interrupt code otehrwise it wil be just guesses... Regards |
|
|
|
您好,您可能看到的是代码优化的结果。可能是“公共子表达式元素化”的结果:如果您在相同的函数中有相同的操作语句,即使XC8编译器的自由模式也可以进行类似的优化。在两个代码块中,都有相同的:注释中的错误与编译器无关。MPLAB X’Project属性“XC8编译器”中有一些设置命令行选项,要求编译器避免执行优化,以便使调试更加可预测,而不用担心调试器生成S。有些奇怪的跳跃,你可以试着观察最终结果是否是你想要的。
以上来自于百度翻译 以下为原文 Hi, What you see is probably result of code optimization. Possibly a result of 'common subexpression elemination': If you have statements doing the same operation in the same function, even the free mode of XC8 compiler may make optimizations like that. In both the code blocks, there are identical: flag_CONTACT_BOUNCE = 1; TMR2ON = 1; Differences in comments do not matter to the compiler. There are some settings in MPLAB X 'Project Properties' 'xc8 compiler' to make command line options to ask the compiler to refrain from performing optimizations, in order to make debugging more predictable. Instead of worrying about debugger making some weird jumps, you may try to observe if the end result is what you want. Regards, Mysil |
|
|
|
每个人,谢谢你看一看。@ Mysil,我认为这确实是正在发生的事情。我正在使用免费的XC8编译器,所以我不希望发生任何优化。你是正确的,因为结果似乎是相同的(总是)优化后……和我正在经历的问题,使我开始调试ISR首先可能已经涉及到另一个问题…我会进一步调查,但我认为你把我放在正确的轨道上。谢谢大家。
以上来自于百度翻译 以下为原文 Everyone, thanks for having a look at it. @Mysil, I think this is indeed what is happening. I am using the free XC8 compiler so I was not expecting any optimization to take place. You are right in that the outcome seems to be same (always) after optimization... And the problems I was experiencing that caused me to start debugging the ISR in the first place may have been related to another issue... I will investigate this further, but I think you have put me on the right track. Thanks all |
|
|
|
坏的假设。免费的允许有限的优化。可以禁用调试的所有优化。
以上来自于百度翻译 以下为原文 Bad assumption. The free one does allow limited optimisation. You can disable all optimisation for debugging. |
|
|
|
只有小组成员才能发言,加入小组>>
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 05:36 , Processed in 1.519030 second(s), Total 84, Slave 68 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号