美文网首页
EX17AVR ATmega8A EEPROM read and

EX17AVR ATmega8A EEPROM read and

作者: 山前雨1 | 来源:发表于2018-06-14 10:33 被阅读8次

//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

相关文章

网友评论

      本文标题:EX17AVR ATmega8A EEPROM read and

      本文链接:https://www.haomeiwen.com/subject/trbeeftx.html