完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我正在研究一个程序,它使用片上闪存的RTSP(实时自编程)来保存预置。当芯片被编程时,有可能实例化一个值给闪存(例如预设的默认值)吗?我用的是一个带有ICP标题的PICtiT3。按照目前的情况,预设保存是有效的,但是默认值是0。如果程序员可以设置默认值,那就好了,这样我们就不用手动去设置默认值了。
以上来自于百度翻译 以下为原文 Hi, I am working on a program that uses RTSP (Real Time Self Programming) of the on chip flash memory to save presets. Is it possible to instantiate a value to the flash memory (e.g. a default value for the preset) when the chip is programmed? I am using a PICKit3 with an ICP header. As things currently stand, preset saving is working, but the value is 0 by default. It would be nice if the programmer could set the default values, so that we wouldn't have to go in and set them manually. How can I do this? |
|
相关推荐
12个回答
|
|
嗨,我很抱歉,但我不明白你想做什么……你想做什么:一个特定的PIC设备?你使用哪种编程软件?预置值是什么意思?当做
以上来自于百度翻译 以下为原文 Hi, I'm sorry but I do not understand what you are trying to do.... What are you trying to program : a specific PIC device ? Which programming software do you use ? What do you mean by preset value ? Regards |
|
|
|
通常,你声明一个变量,它位于一个固定的地址,在那里你的“预设”是和你根据需要初始化的。或者,你在程序开始时检查你的“预设”,如果你得到0xFF(默认为未编程的Flash),你就使用默认值。
以上来自于百度翻译 以下为原文 Generally, you declare a variable which is located at a fixed address where your "presets" are and you initialize it as needed. Alternatively, you check your "presets" at the beginning of the program and if you get 0xff (default for unprogrammed flash) you use default values. |
|
|
|
RISC HI,感谢您的回应,以下是您的问题的答案:我正在用MPLAB X编写PIC32 MX250F128B的C程序。我的应用是吉他效应踏板,其中影响参数由电位器控制。为了让用户节省效果预置,我使用芯片的RTSP能力来保存程序快闪存储器中的POT值,后者在芯片上电时被召回。我有这么多的工作,并成功地保存和回忆电位器值使用这种方法。这里是我想知道的:在第一次编程的芯片,闪存的部分,我使用RTSP充满了0的值,这意味着该芯片最初读取PRES。ET作为所有参数的值为0。我希望能够用程序员把指定的值填充到Flash存储器中,这样我们就可以很容易地加载到我们自己的预设中,而不必手工操作。我声明RTSP所用的内存空间如下:我希望能够设置音频PopaRAM.PR的值。ESET [0-3]使用PACTIT3编程器以这样的方式不干扰用户稍后改变这些值的能力。我该怎么做呢?
以上来自于百度翻译 以下为原文 @RISC Hi, thanks for your response, here are the answers to your questions: I am writing a C program for the PIC32MX250F128B using MPLAB X. My application is a guitar effects pedal, where effects parameters are controlled by potentiometers. In order to allow the user to save effects presets I am using the RTSP capabilities of the chip to save pot values in program flash memory, which are later recalled when the chip is powered on. I have this much working, and am successfully saving and recalling potentiometer values using this method. Here is what I would like to figure out: Upon first programming the chip the section of flash memory I use for RTSP gets filled with a values of 0, meaning that the chip initially reads the preset as all parameters having a value of 0. I would like to be able fill this section of flash memory with designated values using the programmer, so that we can easily load in some of our own presets without having to do so manually. I declare the memory space used by RTSP as follows: volatile const union { volatile const uint8_t array[4096]; volatile const uint32_t preset[3]; }audioParams __attribute__((space(prog), address(0x9D010000))); I would like to be able to set the value of audioParams.preset[0-3] using the PICKit3 programmer in such a way that does not interfere with the later ability of the user to change these values. How can I do this? |
|
|
|
好的,假设我声明我的预设变量如下,我如何改变这个声明来实例化一个默认值使用程序员?我必须对这个声明采取预防措施,以确保它不影响用户改变内存位置值的能力吗?
以上来自于百度翻译 以下为原文 Okay, given that I am declaring my preset variables as follows, how can I change this declaration to instantiate a default value using the programmer? Do I have to take precautions with this declaration to ensure that it does not interfere with the users ability to change the value of this memory location? volatile const union { volatile const uint8_t array[4096]; volatile const uint32_t preset[3]; }audioParams __attribute__((space(prog), address(0x9D010000))); |
|
|
|
|
|
|
|
好的,太棒了!很高兴听到这很简单。我担心这可能会覆盖用户对闪存的某些改变,但它确实很方便,但你能解释一下它是如何运作的吗?
以上来自于百度翻译 以下为原文 Okay great! Glad to hear it is that simple. I was worried that this might override the changes to flash memory made by the user in some way but it's certainly very convenient that it doesn't. Could you perhaps explain the mechanics behind how this works? |
|
|
|
当芯片被编程时,指定的初始值被放入闪存。当你更新它时,你正在改变它存储的值。你现在得到零点,因为这是当你没有指定任何初始值时默认的。
以上来自于百度翻译 以下为原文 The initial value specified there is put into FLASH when the chip is programmed. When you update it, you are changing the value it stored. You are getting zeroes now, because that is what it defaulted to when you failed to specify any initial value. |
|
|
|
嘿,当我尝试的时候,我得到了下面的错误:这里正是我正在做的:是什么导致了这个?
以上来自于百度翻译 以下为原文 Hey when I try that I get the following error: error: expected ':', ',', ';', '}' or '__attribute__' before '=' token Here is exactly what I am doing: volatile const union { volatile const uint8_t array[4096]; volatile const uint32_t preset[3] = {0, 2048, 0}; } audioParams __attribute__((space(prog), address(0x9D010000))); What is causing this? |
|
|
|
语法错误。不能初始化类型,只能初始化变量。请阅读一本好的C书。
以上来自于百度翻译 以下为原文 Syntax errors. You cannot initialize types, only variables. Read a good C book. |
|
|
|
语法错误。不能初始化类型,只能初始化变量。读一本好的C书。那么,为了初始化数组,我需要做些什么不同的事情呢?这是其他人在这个线程上的建议解决方案。这仅仅是在联合声明之外初始化其他数组的问题吗?例如。:
以上来自于百度翻译 以下为原文 Syntax errors. You cannot initialize types, only variables. Read a good C book. So what do I need to do differently in order to initialize the array correctly? That was the suggested solution by others on this thread. Is it simply a matter of initializing the array elsewhere outside of the union declaration? E.G.: volatile const union { volatile const uint8_t array[4096]; volatile const uint32_t preset[3]; } audioParams __attribute__((space(prog), address(0x9D010000))); volatile const uint32_t preset[3] = {0, 2048, 0}; |
|
|
|
编译器不喜欢Union定义中的初始化器。但是,您可以在声明它之后初始化它。
以上来自于百度翻译 以下为原文 The compiler doesn't like initializers inside the union definition. However, you can initialize it after declaring it. volatile const union { volatile const uint32_t preset[3]; volatile const uint8_t array[4096]; } audioParams __attribute__((space(prog), address(0x9D010000))) = {.preset = {0, 2048, 0}}; |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
5150 浏览 9 评论
1994 浏览 8 评论
1924 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3165 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2221 浏览 5 评论
716浏览 1评论
602浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
488浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
617浏览 0评论
515浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-15 02:23 , Processed in 1.413826 second(s), Total 100, Slave 83 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号