完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
您好,我已经能够在RAM中指定一个特定地址的RAM,但我的问题是,是否有一种简单的方法使用地址而不是变量名从RAM位置提取数据呢?我是一个编程新手,我似乎找不到一个简单的方法来获取这些信息。非常感谢,吉姆。
以上来自于百度翻译 以下为原文 Hello, I have been able to assign some ram at a specific address in ram but my question is, is there a simple way to extract the data from the ram location using the address rather than the variable name? I am somewhat of a newbie to programming and I can not seem to find an easy way to get this information. Much Thanks, Jim |
|
相关推荐
6个回答
|
|
|
可以使用C语言指针。但这可能不是最好的方式。为什么不叫这个名字呢?
以上来自于百度翻译 以下为原文 You can Use a C language pointer. But that may not be the best way. Why Not the Name? |
|
|
|
|
|
谢谢你,NKurzman,我是一个学习如何“代码”的硬件电子工程师,我主要使用DSPICS来运行控制循环,但是需要我增加我的编码能力,非常感谢增加我的学习。圣问候,吉姆
以上来自于百度翻译 以下为原文 Thank you NKurzman, I'm a hardware electronic engineer learning to how to "code", I have primarily been using dsPics to run control loops but the need for me to increase my coding ability is increasing, much thanks for increasing my learning the pointer works like a champ after I did some reading. Best Regards, Jim |
|
|
|
|
|
我已经发布了一个答案,但是我的文章神秘地消失了:(你可以在绝对地址上定义一个变量。我认为,XC16用它来做这件事:这不是一个好主意,除非有一个很好的理由这样做。绝对变量对编译器进行分配时是不好的,因为它必须在它们周围工作。你也可以这样做:但是这并不在指定的地址保留空间,所以编译器可能会把其他东西拍到这个地方。
以上来自于百度翻译 以下为原文 I have posted an answer, but my post mysteriously disappeared :( You can define a variable at absolute address. I think, XC16 does it with __at(): int x __at(0x500); It is not a good idea too unless there's a good reason to do this. Absolute variables are bad for the compiler when it does allocations because it has to work around them. You can also do: v = *(int*)0x500; but this doesn't reserve the space at the specified address, so the compiler may slap something else to the place. |
|
|
|
|
|
谢谢你,North Guy,我也要试试这个。非常感谢。
以上来自于百度翻译 以下为原文 Thank you North Guy, I will try out the __at() as well. Much Thanks |
|
|
|
|
|
确保在项目属性中检查“使用CCI语法”。
以上来自于百度翻译 以下为原文 Make sure "Use CCI Syntax" is checked in the project properties. |
|
|
|
|
|
或:INTyAtAtditTyx((地址(0x1100)))var;如果“使用CCI语法”未被检查。
以上来自于百度翻译 以下为原文 Or: int __attribute__((address(0x1100))) var; if "Use CCI Syntax" is not checked. |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
485 浏览 0 评论
5806 浏览 9 评论
2346 浏览 8 评论
2234 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3540 浏览 3 评论
1145浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1114浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
883浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
489浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-9 13:53 , Processed in 1.726302 second(s), Total 85, Slave 67 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
4217