Flash EEPROM component
Author | The-Box Development |
Version | 1.0 |
License | BSD |
Category | Storage |
Contents
Flash EEPROM component
The Flash EEPROM component provides EEPROM emulation for PIC24 and dsPIC series controllers using Flash memory. The component simulates persistence between runs using an external file to store the information.
The component provides storage for 253 words of 16 bits (UINT).
The component uses a wear leveling algorithm which requires 2 full 'erase' pages of memory. The 'erase' page size for a particular device can be found in the data sheet. Look for the 'erase program memory block size', typically a value of 1536 or 3072 bytes (512 or 1536 words).
NOTE The component stores values in primary flash. This part of flash memory will be wiped when programming new code to the controller!
Downloadable macro reference
Initialise
Initialize the internal state of the component.
Parameters
No parameters
Return value
The macro returns 0 when successful. Any value unequal 0 means failure.
Read
Reads one word of 16 bits (UINT).
Parameters
- Byte address
- The address to read the data from. The address should not exceed 253.
Return value
Write
Write a 16 bit word (UINT) to memory.
Parameters
- BYTE address
- The address to write the data to. The address should not exceed 253.
- UINT value
- The 16 bit value to store.
Return value
The macro returns 0 when successful. Any value unequal 0 means failure.
Simulation macro reference
This component does not contain any simulation macros
Property reference
Simulation file
This property is of type Filename
The name of the file to store data during simulation runs.
Auto Address
This property is of type True or false and can be referenced with the variable name AUTOADDR.
If set to 'Yes' the component will automatically allocate the required flash memory. If set to No the property Address should be set to a valid value.
Address
This property is of type Unsigned Integer and can be referenced with the variable name FLASHADDRESS.
This property is only available if Auto Address is set to No. Set to a valid address in flash memory beyond the end address of the program. The value must be at the start of an 'erase' page and there should be at least two full 'erase' pages of flash available after the address. Do not use this feature if you are unsure which address can safely be used.
Component
The component can be downloaded from the Matrix user forum