Viết bằn CodeVision C đi.
Code chạy tốt.
void Write_EEPROM(unsigned int dchi, unsigned char dlieu)
{
while(EECR.1);
EEAR = dchi;
EEDR = dlieu;
EECR.2 = 1;
EECR.1 = 1;
}
//doc 1 byte du lieu tu dia chi cua eeprom//////////////////////////
unsigned char Read_EEPROM(unsigned int dchi)
{
while(EECR.1);
EEAR = dchi;
EECR.0 = 1;
return EEDR;
}
Code chạy tốt.
void Write_EEPROM(unsigned int dchi, unsigned char dlieu)
{
while(EECR.1);
EEAR = dchi;
EEDR = dlieu;
EECR.2 = 1;
EECR.1 = 1;
}
//doc 1 byte du lieu tu dia chi cua eeprom//////////////////////////
unsigned char Read_EEPROM(unsigned int dchi)
{
while(EECR.1);
EEAR = dchi;
EECR.0 = 1;
return EEDR;
}
Comment