AVR EEPROM读写
{
while (EECR&(1
EEDR = data;
EECR |= (1
unsigned char Read_byte_eeprom(unsigned short address)
{
while (EECR&(1
EECR |= (1
return EEDR;
}
void Refresh_eeprom(void)
{
unsigned char i = 0;
unsigned char check = 0;
unsigned char *p = (unsigned char *)&ram;
asm("cli");
ram.start = 0x55;
for (; i<(sizeof(ram)-1); i++)
{
Write_byte_eeprom(i,*(p+i));
check += *(p+i);
}
Write_byte_eeprom(i,check);
asm("sei");
}
void Read_eeprom(void)
{
unsigned char i = 0;
unsigned char check = 0;
unsigned char *p = (unsigned char *)&ram;
for (; i<(sizeof(ram)-1); i++)
{
*(p+i) = Read_byte_eeprom(i);
check += *(p+i);
}
*(p+i) = Read_byte_eeprom(i);
//取值合理性判断
if ((*(p+i) != check) || (*p != 0x55))
{
Parameter_reset();
}
}
AVREEPROM读 相关文章:
- AVR EEPROM 读写实验(11-13)
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)