复件 eeprom.c

来自「用avr 操作eeprom的一个实例程序」· C语言 代码 · 共 42 行

C
42
字号
#include <avr/io.h>
#include <util/delay.h> 
#include<avr/wdt.h>
#include <avr/eeprom.h>


//char EEMEM a ,b; 



int main(void) 
{
/*

 unsigned int temp3;
 unsigned char temp1,temp2;                                  /*定义变量*/
 unsigned char buffer[10];                                   /*定义数组*/
 unsigned char buf[]="10101100";                        /*定义字符串*/
 //eeprom_busy_wait();
 eeprom_write_byte ((unsigned char *)0x05,'f');     /*单字符写入到0x10,注意是单引号*/
                                
// eeprom_busy_wait();
 //temp1 =eeprom_read_byte((unsigned char *)0x05);         //读出一个字节                              
 
// eeprom_busy_wait();
 eeprom_write_block((unsigned char *)buf,(unsigned char *)0x20,6);   /*写字符串到0x20*/
// eeprom_busy_wait();
 //eeprom_read_block(buffer,(unsigned char *)0x20,6);    //连续读入一串数据

 unsigned int tt=0x5213;

  eeprom_write_word((uint16_t *)9,tt);          //写一个字 

//temp3 =eeprom_read_word((unsigned int *)6);     //读一个字


 while(1) ;

*/

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?