EX17AVR ATmega8A EEPROM read and

2018-06-14  本文已影响8人  山前雨1

//EX17AVR ATmega8A EEPROM read and write//authorI小米粥//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

上一篇 下一篇

猜你喜欢

热点阅读