>
> >> then use an EEPROM reading routine to get it
>
>So I am assuming from this that there will be similar quirks
>to access eeprom... alright !
Not that odd.
Wait for the busy flag to not be true, address WDT issues if necessary
Set EARL and EARH, issue a read command, and pick up the result.
Put the address register to non-existent space in case of a rouge write.
This routine assumes Z is set with the address in EEspace, and data is in TEMP
TEMP2 is just a scratch register.
Read_EE:
in TEMP2,EECR ;Poll for EECR,2=0 before continuing!
andi TEMP2,$03 ;Not sure you need ALL
flags=0 but it's harmless
;See bug description in Write_EE
brne Read_EE ;Potential to loop forever.
out EEARH,ZH ;Set up the address
out EEARL,ZL ;
sbi EECR,EERE ;Set EE Read Enable
in TEMP,EEDR ;Get the data
adiw ZL,1 ;Inc the pointer
ldi TEMP2,$FF ;Point at non-existent location
out EEARL,TEMP2 ;when not in active use.
out EEARH,TEMP2 ;
ret ;Message
Re: [AVR-Chat] Re: This assembly oughta be something silly...Thanks
2005-06-16 by Dave VanHorn
Attachments
- No local attachments were found for this message.