main.c
来自「avr单片机的一些实际应用源码」· C语言 代码 · 共 31 行
C
31 行
/*
avr-libc EEPROM 读写测试程序 <2313 - 1>
main.c
MCU:at90s2313
芯艺 2004-09-11
*/
#include <avr/io.h>
#include <avr/eeprom.h>
#define SET_LED PORTD=0X10;//PD4接有LED
int main(void)
{
DDRD=0X10;
PORTD=0X00;
eeprom_busy_wait();
eeprom_write_byte(0,0xaa);
eeprom_busy_wait();
eeprom_write_block("hello,this is test eeprom",(void *)1,sizeof("hello,this is test eeprom"));
eeprom_busy_wait();
if(eeprom_read_byte(0)==0xaa)
SET_LED;
while(1);
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?