完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我已经在论坛上很好地找到了这个,但没有真正找到我需要的。这是我需要做的……/一个校准值被存储在EEPROFSTREST CAL{浮标斜率;浮点偏移;},然后在主(…)中,我有/…存储六组校准值结构校准[通道];//这些EEEEPROI需要在正常RAM中加载所有的这些工作拷贝,当它被校准并在校准完成时保存它们。我使用PIC16F1834,它不让我使用EEPROM声明。从数据表看来,你可以直接读写EEPROM,但是因此,我必须创建一个char的结合来共享与校准[通道]变量相同的空间,以确保它们在内存中都是连续的吗?如何设置一个指向EEPROM启动地址的指针,我可以把它传递给EEPROMYWREST()函数?非常感谢。RogerMany谢谢你的回复,我看不出如何回应,似乎没有任何办法。
以上来自于百度翻译 以下为原文 I've had a good look for this on the forum but not really found what I need. This is what I need to do... //A single calibration value to be stored in EEPROM struct cal { float slope; float offset; }; ..then in main() I have.. // stores for six sets of calibration values struct cal calibration[CHANNELS]; //These go in EEPROM I need to load all of these into working copies in normal RAM when it powers up and save them all when calibration is done. I'm using a PIC16F18344 which won't let me use the eeprom declaration. From the datasheet is looks like you can read and write directly to the EEPROM but only byte by byte. So do I have to create a union of char to share the same space as the calibration[CHANNELS] variable to make sure they are all consecutive in memory? How do I set a pointer to the eeprom start address that I can pass to the eeprom_write() function? Any help would be greatly appreciated. Thanks, Roger Many thanks for the replies, I can't see how to respond in line, there doesn't appear to be any way to do that. |
|
相关推荐
2个回答
|
|
您可以创建一个联合,或者使用一个指针。你可以把它们当作一组来处理,或者一次处理一个。EEPROM从零开始。每个条目是1字节。你可以从那里工作
以上来自于百度翻译 以下为原文 You can create a union, or use a pointer. you can treat them as a group, or handle them one at a time. The EEPROM starts at zero. Each entry is 1 byte. you can work from there |
|
|
|
将一组浮点数或字符或其他类型的数组写入EEPROM没有什么特别的,这就是为什么C有空类型的原因。
以上来自于百度翻译 以下为原文 There's nothing specific about writing an array of floats or a char or any other type to EEPROM; that's why C has a void type.void eeprom_write_block(void *ptr, unsigned short addr, unsigned char len) { unsigned char *data = ptr; while (len--) eeprom_write_byte(addr++, *data++); } unsigned long u; eeprom_write_block(&u, 30, sizeof u); float array[10]; eeprom_write_block(array, 30, sizeof array); |
|
|
|
只有小组成员才能发言,加入小组>>
5184 浏览 9 评论
2005 浏览 8 评论
1932 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3179 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2229 浏览 5 评论
739浏览 1评论
626浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
511浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
637浏览 0评论
535浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-28 07:19 , Processed in 1.365879 second(s), Total 78, Slave 62 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号