完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛扫一扫,分享给好友
|
你好,我是固件开发的新手。我想知道在调试过程中是否有一种方法来监视预处理器指令?例如,我正在研究电机控制应用的示例固件。#define PMOD_SEL(PMOD1|PMOD2|PMOD3)define PENH_ENA(PEN1H|PEN2H|PEN3H)define PWM_COUNTS_PER_PER_PERIOD(FCY/FPWM-1)在调试期间,我如何观看PMOD_SEL或PWM_COUNTS_PER_PER_PERIOD?有什么办法可以做到这一点吗?谢谢您,
以上来自于百度翻译 以下为原文 Hello, I am new to firmware development. I was wondering if there's a way to watch preprocessor directives during debug? for example, I am studying a sample firmware for motor control applications. #define PMOD_SEL (PMOD1 | PMOD2 | PMOD3) #define PENH_ENA (PEN1H | PEN2H | PEN3H) #define PWM_COUNTS_PER_PERIOD (FCY/FPWM -1) during debug, how would I watch PMOD_SEL or PWM_COUNTS_PER_PERIOD? is there any way to do this? thank you, |
|
相关推荐
6个回答
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
在调试中观看宏有什么意义?它们在运行时不会改变。在运行时甚至不存在。
以上来自于百度翻译 以下为原文 What's the point of watching macros in debug? They don't change during run time. Don't even exist at run time. |
|
|
|
|
|
我想验证它们是否被评估为所期望的,并且它们可能是(希望)在源代码中使用的。;)
以上来自于百度翻译 以下为原文 I guess to verify they are evaluated to what are expected, and they are probably (hopefully) used in the source code. ;) |
|
|
|
|
|
不是ifPMOD1、PMOD2等是变量或寄存器。您无法从编码风格中辨别出来。#define PMOD_SEL()(PMOD1|PMOD2|PMOD3)将指示它不仅仅是一个常数。
以上来自于百度翻译 以下为原文 not if PMOD1, PMOD2, ect are variables or registers. You can't tell from the coding style. #define PMOD_SEL() (PMOD1 | PMOD2 | PMOD3) would indicate it is Not just a constant. |
|
|
|
|
|
宏只是一个文本替换规则,它在特定的上下文中进行评估,并且可能产生代码,也可能不产生代码。如果你想具体化它,你需要使它变成一些有形的,如Harry建议的变量。但是如果你这样做,然后观察变量,你将不会看到实数。我注册,而是在过去某个时间点计算的值。如果您现在正在查看x,则不能获得端口的当前值,而是x的值,这取决于分配的时间。如果您想知道端口中是否发生了更改,则需要确保代码执行再次徘徊在分配中。另一方面,您可以在调试器中实时观看PORTA、PORTB和PORTC,并手动进行计算。这将永远是最新的。
以上来自于百度翻译 以下为原文 Macro is just a text substitution rule, which is evaluated in certain context, and may or may not produce code. If you want to materialize it, you need to make it into some tangible, such as variable as Harry suggests. But if you do this and then watch the variable, you will not be watching the real-time registers, but rather the value calculated at some point in the past. #define ALLPORT (PORTA|PORTB|PORTC) x = ALLPORT; ... some code Nop(); // breakpoint here. Values of ports may have changed. If you're now watching x, you don't get the current value of the ports, but the value of x which depends on the time it was assigned. If you're wondering if something has changed in ports you need to make sure your code execution wanders through the assignment again. On the other hand, you can watch PORTA, PORTB, and PORTC in real time in your debugger and do the calculation manually. This always will be up to date. |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
495 浏览 0 评论
5808 浏览 9 评论
2347 浏览 8 评论
2237 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3542 浏览 3 评论
1152浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1118浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
886浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
499浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-11 20:08 , Processed in 0.612853 second(s), Total 52, Slave 45 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
1145