At 12:10 PM 7/04/2006, you wrote:
> Would you please post the routine you used to write to the EEPROM?
All your precautions will come to nothing unless you
remember to turn off interrupts whilst writing to the
EEPROM. It will work most of the time / sometimes but
you are likely to get write errors if an interrupt happens
during the write cycle.
Here is my EEPROM write routine in assembler (sorry don't do C :-) )
;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
Regards
John Samperi
********************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495 Fax (02) 9674-8745
Email: john@ampertronics.com.au
Website http://www.ampertronics.com.au
*Electronic Design * Custom Products * Contract Assembly
********************************************************Message
Re: [AVR-Chat] EEPROM writing with elec. noise
2006-04-07 by John Samperi
Attachments
- No local attachments were found for this message.