| Purpose: | Write one (1), two (2), or four (4) successive BYTEs to EEPROM. | |||
| Assumes: | BYTEs in EEPROM are read from Least Significant to Most Significant. | |||
| Passed: | R25:R24 | VOID * | vPtrEEPROM | address of the EEPROM first or only BYTE to write |
| R22 | BYTE | bValue | the BYTE value to write to that EEPROM address (OR) | |
| R23:R22 | WORD | wValue | the WORD value to write to that EEPROM address (OR) | |
| R23:R22:R21:R20 | ULONG | ulValue | the ULONG value to write to that EEPROM address | |
| Alters: | The EEPROM Registers (EEARL, EEARH, EECR and EEDR), FLAGs; possibly R22, R23 and/or R24. | |||
| Example: |
|
| Test it: | EEPROM data change ebugging MUST be ON (use "#") to generate this output: |
| |
| Notes: | In order to minimize the number times any specific EEPROM BYTE is written, these routines first read the present value (of each BYTE.) If it is the same as the value to be written, that BYTE is skipped. |
| The write is not even attemped for any address past the end of physical EEPROM, which is 1,023 (= 0x3FF) for a 328P. | |
| Dropin: (setup code) |
; Setup for the WriteEEPROM_*() call: ; Passed: R25:R24 VOID * vPtrEE address at which to begin writing ; R22 BYTE bValue of the BYTE data to write (OR) ; R23:R22 WORD wValue of the WORD data to write (OR) ; R23:R22:R21:R20 ULONG ulValue the ULONG data to write ; Alters: Possibly R22, R23, and/or R24, FLAGs and the EEPROM ; (also: EEARL, EEARH, EECR and EEDR, of course) |
| Also see: | The WriteEEPROM_BYTE, WriteEEPROM_WORD, and WriteEEPROM_ULONG System Functions as well as the "#" EEPROM change toggle key. |