📄 main.c
字号:
/*
avr-libc EEPROM 读写测试程序 <2313-2>
main.c
MCU:at90s2313
芯艺 2004-09-11
*/
#include <avr/io.h>
#include <avr/eeprom.h>
#define SET_LED PORTD=0X10;//PD4接有LED
char val1 __attribute__((section(".eeprom")))=0xaa;
char val2[] __attribute__((section(".eeprom")))="hello,this is test eeprom";
int main(void)
{
DDRD=0X10;
PORTD=0X00;
eeprom_busy_wait();
eeprom_write_byte(&val1,0xaa);
eeprom_busy_wait();
eeprom_write_block("hello,this is test eeprom",val2,sizeof("hello,this is test eeprom"));
eeprom_busy_wait();
if(eeprom_read_byte(&val1)==0xaa)
SET_LED;
while(1);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -