Почему такой вывод ?rw6hrm wrote: работать явно не будет.
Описание процесса из даташита на 2313 (doc8246.pdf)
Code: Select all
Before writing data to EEPROM the target location must be erased. This can be done either in
the same operation or as part of a split operation. Writing to an unerased EEPROM location will
result in corrupted data.
To write an EEPROM memory location follow the procedure below:
• Poll the EEPROM Program Enable bit (EEPE) in EEPROM Control Register (EECR) to make sure no other EEPROM operations are in process. If set, wait to clear.
• Set mode of programming by writing EEPROM Programming Mode bits (EEPM0 and EEPM1) in EEPROM Control Register (EECR). Alternatively, data can be written in one operation or the write procedure can be split up in erase, only, and write, only.
• Write target address to EEPROM Address Registers (EEARH/EEARL).
• Write target data to EEPROM Data Register (EEDR).
• Enable write by setting EEPROM Master Program Enable (EEMPE) in EEPROM Control Register (EECR).
Within four clock cycles, start the write operation by setting the EEPROM
Program Enable bit (EEPE) in the EEPROM Control Register (EECR). During the write
operation, the CPU is halted for two clock cycles before executing the next instruction.
The EEPE bit remains set until the write operation has completed.
While the device is busy with programming, it is not possible to do any other EEPROM operations.
в моей редакции

Code: Select all
EEPROM_write:
; Wait for completion of previous write
sbic 0x1C, 1
rjmp EEPROM_write
; Set Programming mode
ldi r16, (0<<5)|(0<<4)
out 0x1C, r16
; Set up address (r17) in address registers
out 0x1E, r17
; Write data (r18) to data register
out 0x1D, r18
; Write logical one to EEMPE
sbi 0x1C, 2
; Start eeprom write by setting EEPE
sbi 0x1C, 1

1. Нужно установить режим программирования
ldi r16, (0<<EEPM1)|(0<<EEPM0)
out 0x1C, r16
ВСЕ !!!
