CodeVisionAVR EEPROM busy wait

Status
Not open for further replies.

azadfalah

Full Member level 2
Joined
Aug 13, 2016
Messages
145
Helped
1
Reputation
2
Reaction score
2
Trophy points
1,298
Activity points
2,423
Hello everyone

i want read and write from EEPROM but i don't want use delay i want use EEPROM busy flag check


x= EEPROM_x

EEPROM busy flag while

y=EEPROM_y

EEPROM busy flag while

i don't know how check eeprom busy flag in CodeVisionAVR

Thank
 

Hi,

did you read the AVR datasheet?

Usually there are ASM as well as C examples for EEPROM read/write, including busy_flag_check.

Klaus
 
Code:
C Code Example
unsigned char EEPROM_read(unsigned int uiAddress)
{
/* Wait for completion of previous write */
while(EECR & (1<<EEWE))
;
/* Set up address register */
EEAR = uiAddress;
/* Start eeprom read by writing EERE */
EECR |= (1<<EERE);
/* Return data from data register */
return EEDR;
}

so i should only use while(EECR & (1<<EEWE)) /* Wait for completion of previous write */ it's true ?
 

Hi,

Yes.

What else did you expect?
--> trust the datasheet.

Klaus
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…