Microchip's __EPROM_DATA macro statement
Posted: Wed Aug 01, 2018 11:51 pm
Microchip's help desk said the __EEPROM_DATA macro is the only way they recommend to initialize the EEPROM values at programming time.
E.G. place as many '8 byte' long __EEPROM_DATA statements as you need. It is simple and works always. Compiler places data in the order you will have them in your C code. If you need some bytes to be unchanged then place 0xFF for them. Eg.
__EEPROM_DATA(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF); // addr: 0x00 ... 0x07
__EEPROM_DATA(0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88); // addr: 0x08 ... 0x0F
__EEPROM_DATA(0x55, 0x66, 0x87, 0x65, 0xFF, 0xFF, 0xFF, 0xFF); // addr: 0x10 ... 0x17
etc
etc
But it is unwieldy and for a 256 bytes of on board PIC EEPROM you end up with 32 statements.
My question: Where do I place these statements in Flowcode? In a Calculation icon or in the Supplementary Code or some other?
Thanks in advance.
E.G. place as many '8 byte' long __EEPROM_DATA statements as you need. It is simple and works always. Compiler places data in the order you will have them in your C code. If you need some bytes to be unchanged then place 0xFF for them. Eg.
__EEPROM_DATA(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF); // addr: 0x00 ... 0x07
__EEPROM_DATA(0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88); // addr: 0x08 ... 0x0F
__EEPROM_DATA(0x55, 0x66, 0x87, 0x65, 0xFF, 0xFF, 0xFF, 0xFF); // addr: 0x10 ... 0x17
etc
etc
But it is unwieldy and for a 256 bytes of on board PIC EEPROM you end up with 32 statements.
My question: Where do I place these statements in Flowcode? In a Calculation icon or in the Supplementary Code or some other?
Thanks in advance.