Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] EEPROM writing with elec. noise

2006-04-07 by David VanHorn


;Put 1 byte in temp to address pointed by Z.
put_ieep_byte:
sbic EECR,EEWE ;Wait for completion of previous write
rjmp put_ieep_byte
cli
out EEARH,zh ;Set up address (in Z ) in
address register
out EEARL,zl
out EEDR,temp ;Write data (temp) to data register
sbi EECR,EEMWE ;Write logical one to EEMWE
sbi EECR,EEWE ;Start eeprom write by setting EEWE
sei
ret
But you don't really need to CLI till just before the SBI EECR.
That's the only part that has to be atomic.
This does assume that your ISR preserves Z

--
Feel the power of the dark side! Atmel AVR

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.