找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3781|回复: 3
打印 上一主题 下一主题
收起左侧

这是我写的对Arduino单片机Eeprom进行读写的源程序

[复制链接]
跳转到指定楼层
楼主
ID:284143 发表于 2018-2-15 10:15 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
这是我写的对Arduino单片机Eeprom进行读写的源程序,
可以为Arduino内存不够提供一种可行的解决方案,
希望能给大家一些帮助。

Arduino源程序如下:
  1. #include <EEPROM.h>
  2. int address = 0;
  3. byte value;

  4. void setup()
  5. {
  6.   // put your setup code here, to run once:
  7.       Serial.begin(9600);
  8. }

  9. void loop()
  10. {
  11.   // put your main code here, to run repeatedly:
  12.   
  13.   for(int i=0;i<512;i++)
  14.   {
  15.     EEPROM.write(address,i);address++;
  16.     }
  17.    address=0 ;
  18.     for(int i=0;i<512;i++)
  19.   {
  20.     value=EEPROM.read(address);
  21.       Serial.print(address);
  22.       Serial.print("\t");
  23.      Serial.print(value, DEC);
  24.      Serial.println();
  25.       delay(100);address++;

  26.     }

  27.     for (int i = 0; i < 512; i++)
  28.     EEPROM.write(i, 0);
  29.        address=0 ;
  30.     for(int i=0;i<512;i++)
  31.   {
  32.     value=EEPROM.read(address);
  33.       Serial.print(address);
  34.       Serial.print("\t");
  35.      Serial.print(value, DEC);
  36.      Serial.println();
  37.       delay(1000);address++;

  38.     }
  39.     address=0 ;

  40. }
复制代码

所有资料51hei提供下载:
EEPROMxieduchu.zip (624 Bytes, 下载次数: 15)


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:283944 发表于 2018-2-15 22:27 来自手机 | 只看该作者
谢谢啦,学习了,新年快乐
回复

使用道具 举报

板凳
ID:299214 发表于 2018-3-29 23:40 | 只看该作者

感谢分享!我正在学习!
回复

使用道具 举报

地板
ID:706622 发表于 2020-4-26 14:41 | 只看该作者
刚学到这,有点看不懂,可以注释一下吗
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表