void eeprom_write(int addr , char wdata)
{
while((EECR & 0x02) == 0x02); // EEWE = '0'?
EEAR = addr; // EEPROM 주소
EEDR = wdata; // EEPROM 데이터
EECR |= 0x04; // EEMWE = '1'
EECR |= 0x02; // EEWE = '1'
}
char eeprom_read(int addr)
{
while((EECR % 0x02)==0x02);
EEAR = addr;
EECR |= 0x01; // EEPROM 데이터 읽기(EERE=1)
return EEDR;
}
쓰는함수와 읽는 함수
http://magicom9.tistory.com/5
'Old category > 비밀의방' 카테고리의 다른 글
PS/2 키보드 (0) | 2011.10.15 |
---|---|
시리얼통신 (synchronous) (0) | 2011.10.15 |
시리얼통신 (unsynchronous) (0) | 2011.10.15 |
USART (RS232) (0) | 2011.10.15 |
AVR을 이용한 PID 제어 소스 (0) | 2011.10.15 |