//EX17AVR ATmega8A EEPROM read and write//authorI小米粥//data :2018.3.30#include#includevoid init(void)
{
DDRB |=BIT(0);
PORTB &=~BIT(0);
}
void delay(void)
{
int a,b;
for(a=0;a<200;a++)
for(b=0;b<200;b++)
{}
}
void eeproom_w(int data)
{
while(EECR&BIT(1));
EEAR=0X00;
EEDR=data;
EECR |=BIT(2);
EECR |=BIT(1);
}
int eeproom_r(void)
{
while(EECR&BIT(1));
EEAR=0X00;
EECR |=BIT(0);
return EEDR;
}
void main(void)
{
int a;
int n=1;
init();
while(1)
{
if(n==10)
{n=1;}
for(a=0;a
网友评论