首页 > 解决方案 > 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.

标签: cpicbasicxc8

解决方案


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);

推荐阅读