This component implements access to an internal EEPROM of CPU.
The component offers the following features (if they are supported by the hardware) :
Simple byte access
The component provides simple methods allowing to read/write individual bytes (SetByte, GetByte etc.)
- Virtual page
If the Page size property is set to a value
greater than zero, a virtual page is created. The virtual page is an array located in RAM and
the content of the whole array can be transferred between this virtual page and EEPROM by
using the methods SetPage and GetPage. Individual bytes of the virtual page can
be accessed by using the methods GetBytePage, SetBytePage etc.
The address pointer within the virtual page can be automatically pre-incremented
if the methods GetActBytePage, SetActBytePage are used.
The address pointer is set by methods SetBytePage, GetBytePage. It is set to -1 in the after-reset initialization code.
Methods can wait for the end of the operation or exit immediatelly
The write methods can wait until the writing is finished or exit immediatelly. This option
can be controlled at runtime by the SetWait method.
The Busy method can be used for a detection, whether the EEPROM is ready for
the next operation or not.
Interrupt based implementation
If the EEPROM device support interrupt and Interrupt service/event property is
enabled, the OnWriteEnd and OnWritePageEnd events are available. These events
are invoked from all write methods when the write operation finishes.
- Automatic address increment
The address pointer in the EEPROM can be automatically pre-incremented if the methods GetActByte, SetActByte are used.
The address pointer is set by the methods using address as a parameter, such as GetByte, SetByte, GetWord, SetWord, GetLong, SetLong.
Methods GetPage, SetPage set this pointer to the last address of the page.
In the after-reset initialization code, the address pointer is set to the begin of the selected address range.
See also automatic address increment for Virtual page described above.
Version specific information for HCS12, HCS12X, HCS08, ColdFireV1 derivatives
The address pointer is set also by the methods EraseEeprom and EraseSector to the address passed as a parameter - 1.
Error Codes
Methods for read/write operation to/from EEPROM can return the following error codes:
- ERR_BUSY - device is busy (command was not completed)
- ERR_RANGE - operation access memory outside valid bounds
Version specific information for HCS08, ColdFireV1 derivatives
- ERR_NOTAVAIL - EEPROM Access Error
EEPROM memory mapping
The component properties Start address and
Used size have to be configured properly for
a correct memory mapping.
Please note that the component allocates a memory range itself and it mustn't overlap with the EEPROM
memory segment defined in the build options tab of the CPU component (because it is not possible to use memory
both in the component and in the compiler). So if the component is used, corresponding memory area at build
options must be either disabled or adjusted respectively.
Version specific information for HC08 derivatives
Protection
EEPROM block protection can be enabled by FLASH mass erase (for example by using the debugger during development process).
Corresponding block of EEPROM can be unprotected by using SetProtection method.