完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
我试图找到一个bug,这似乎是造成一些(或全部)我的问题。这有道理吗?在这个函数的开始处,我有一个布尔标志声明并初始化为false,即使在函数中有2个步骤之前,它似乎已经分配了8b值(0xee)。这个值阻止了这个例程的操作。THX,提姆
以上来自于百度翻译 以下为原文 I'm trying to find a bug and this seems to be causing some of (or all) my issues. Does this make sense? I have a boolean flag declared and initialized to false at the start of this function that seems to have an 8b value (0xEE) assigned before even making 2 steps into the function. This value is blocking the operation of this routine. Thoughts? Thx, Tim Attached Image(s) |
|
相关推荐
5个回答
|
|
|
这个值是实际使用的吗?(它不在任何可见的代码中。)如果不是,优化器就不会费心初始化它。
以上来自于百度翻译 以下为原文 Is the value actually used? (It's not in any of the code that is visible.) If not, the optimiser wouldn't bother initialising it. |
|
|
|
|
|
HII认为强制变量是为了不为每一个都浪费一个完整的字节。你所看到的值是地址中的字节,而不是一个比特。用监视窗口看它,也许它们可以像SFR一样有点分裂。
以上来自于百度翻译 以下为原文 Hi I think the compuler groups bit variables in order to not waste a full byte for each one of them. The value you are seeing is the byte at the inidcated address, not a single bit. Look at it with the watch window, maybe them you can have a bit split like with the SFRs. |
|
|
|
|
|
是的,比特在代码中被广泛地使用。我想我正在寻找它定义的边界之外的数组访问,但是5K的代码行使搜索有点挑战。我玩它,我认为二进制值可能作为字节字段存储在字节中。奇怪的是,在监视窗口中,它仍然把它称为0xee,而不是1或0。六羟甲基三聚氰胺六甲醚。
以上来自于百度翻译 以下为原文 Yes, the bit is used extensively further on in the code. I think I'm searching for an array access outside of its defined boundary but, 5K lines of code makes the search a bit of challenge. I played with it and I think the binary value is probably stored as a bit field in the byte. Curious...., in the watch window it still refers to it as 0xEE instead of a 1 or 0. Hmmm. |
|
|
|
|
|
在工具提示中显示的“地址”是CPU寄存器。当变量不是“Live”时,同样的寄存器可以用于其他目的,但是调试器可能无法可视化这一点。
以上来自于百度翻译 以下为原文 The "address" shown in the tooltip is a CPU register. The same register may be used for other purposes when the variable is not "live", but the debugger may not be able to visualize this. |
|
|
|
|
|
编译器可以在代码的稍后点初始化“EnthoFiNoX”变量,例如在它首次使用之前。编译器也可以完全优化初始化,例如,如果它知道变量在写入之前从未被读取。这也包括一些情况,其中第一个读取可能会被优化掉,因为编译器已经知道它会读取初始化值。因此,作为ANDERSM状态,变量可能不在当前执行点“Live”。寄存器可能被用于其他事物,或者包含其他东西的旧值。我不知道,但据我所知,调试器经常有识别问题,变量是否是活的。你可以尝试在真正重要的地方检查值。或者在每个执行路径中放置一个yopn&(),并检查哪一个被击中。
以上来自于百度翻译 以下为原文 The compiler has the freedom to initialize the "end_of_name" variable at a later point in code, for example just before it is used the first time. The compiler could also optimize away the initialization completely, for example, if it knows that the variable is never read, before it is written. This also includes cases, where the first read might get optimized away, because the compiler already knows that it will read the initialization value. So, as andersm states, the variable might not be "live" at your point of current execution. The register might get used for something else or contain an old value of something else. I don't really know, but to my knowledge the debugger often has problems with identifying, whether a variable is live or not. You could try to check the value at the point where it really matters. Or place a _nop() in each execution path and check which one gets hit. |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
475 浏览 0 评论
5795 浏览 9 评论
2334 浏览 8 评论
2224 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3530 浏览 3 评论
1126浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1098浏览 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-3 08:52 , Processed in 0.751907 second(s), Total 82, Slave 65 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
15214