c - What is the equivalent of EEDATA from BASIC and EWrite in C language?(How to use the EEPROM with xc8 compiler?)
问题描述
I am having a very hard time figuring out how I can use:
EEDATA = 0xFF, 0x00, 0xFF, 0x00, 0x01, 0x03 ;
and turn that into C code. From what I can understand, it's a way of allocating memory in BASIC, but I really do not know. If anyone out there could help I would much appreciate it.
It was programmed using PROTON. I believe it's got to do with EEPROM used for PIC hardware.
解决方案
I am not really sure what you want to do. But I guess you want to preload your EEPROM with the XC8 compiler. Use the following code:
__EEPROM_DATA(0xFF, 0x00, 0xFF, 0x00, 0x01, 0x03, 0x00, 0x00);
Be sure to always use a block by 8 values.
To write and read the EEPROM you can easily use the library functions:
include xc.h
void eeprom_write(unsigned char addr, unsigned char value);
unsigned char eeprom_read(unsigned char addr);
推荐阅读
- c# - 如何从复杂的 XML 文档结构中获取指定的 Node 值
- intellij-idea - 如何仅通过使用键盘而不是从网站复制将复选标记输入 IDEA?例如复选标记是 ✓ 或 ✗
- apache - 将 curl 请求转换为 php-curl - 收到不同的响应
- python - Python websockets 服务器和 websockets 客户端在运行这两个任务时使用 asyncio 断言错误
- python - 查找相关字段/遍历 Selenium 浏览器结果
- python - 返回一个 DataFrame 与另一个 DataFrame 中不同的行
- javascript - 用动画替换对象值
- ansible - Ansible `archive` 模块无需压缩即可存档
- php - CSV 导出打印完整的 HTML
- c# - Automapper 是否支持映射到自我和更平坦/在同一对象上执行映射