ESP8266开发笔记4-AT24C256读写全流程

Linux AT24C256芯片 数据手册解读 文章目录AT24C256 地址AT24C256页AT24C256写操作AT24C02读操作注意 AT24C256 地址 前四位(1010)是固定的,A2, A1, A0 与硬件连接有关系,外部输入电压为高时是1,外部电压输入为低是0。 本设计中A2, A1, A0都是接地,所以我的设备地址是1010000X,也就是10100000 或10100001。 最后一位R/W是读写位,读操作时为0,写操作时为1。 对于linux IIC子系统,读写位驱动会自动添加,实际设备地址位高七位 1010000B 也 阅读详情

准备硬件

在这里插入图片描述
SCL,SDA默认引脚画反了,但是ESP8266的i2c引脚是可以任意的GPIO口。
在这里插入图片描述
这个是实物啦

代码

在SDK基础上照猫画虎…


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

#include "driver/gpio.h"
#include "driver/uart.h"
#include "driver/i2c.h"

 
#define GPIO_LED_PIN    16
#define GPIO_RLY_PIN    12
#define GPIO_DIR_PIN		5
#define GPIO_OUTPUT_PIN_SEL  ((1ULL << GPIO_LED_PIN) | (1ULL << GPIO_RLY_PIN)|(1ULL << GPIO_DIR_PIN))

//i2c
#define I2C_MASTER_SCL_IO           14                /*!< gpio number for I2C master clock */
#define I2C_MASTER_SDA_IO           2               	/*!< gpio number for I2C master data  */
#define ACK_CHECK_EN                        0x1              /*!< I2C master will check ack from slave*/
#define ACK_CHECK_DIS                       0x0              /*!< I2C master will not check ack from slave */
#define ACK_VAL                             0x0              /*!< I2C ack value */
【ESP开发板】篇六、arduino+L0L1n ESP8266+PCA9548A+AT24C16存取数据 摘要:本文介绍了基于ESP8266和AT24Cxx系列EEPROM的存储系统开发。AT24C系列是美国ATMEL公司的串行EEPROM,通过I2C接口通信,支持多种容量型号(1K-1024K bit)。文章详细说明了芯片引脚定义、多设备连接方式、读写时序图以及各型号参数对比。重点讲解了AT24C16的地址计算方法,并以访问第100页第3字节为例演示了具体操作流程。最后给出了Arduino开发环境下的C++实现代码框架,包括初始化、字节读写和页读写函数接口。该系统适用于需要非易失性存储的嵌入式应用场景。 阅读详情

相关推荐

AT24C01/AT24C02 EEPROM驱动实战:从时序解析到跨页读写优化

本文深入解析AT24C01/AT24C02 EEPROM的驱动开发实战,从时序细节到跨页读写优化。通过实际项目案例,详细介绍了I2C通信的常见问题与解决方案,包括硬件设计注意事项、稳健性驱动设计及高级应用性能优化技巧,帮助开发者提升EEPROM在单片机系统中的可靠性和效率。

weixin_28678831的博客 383

基于RA4M2与ESP8266的嵌入式多功能时钟系统设计

嵌入式时钟系统是物联网终端与智能硬件开发的基础应用场景,其核心在于高精度时间管理、低功耗运行与外设协同控制。本文围绕ARM Cortex-M33微控制器(如瑞萨RA4M2)与Wi-Fi通信模块(ESP8266)的主从架构展开,解析RTC校准、NTP网络授时、SPI Flash资源管理等关键技术原理;强调通过硬件分层设计(核心板+显示板)、标准化接口(SPI/I2C/UART)和固件解耦(FreeRTOS+AT指令)实现功能复用与快速扩展。该方案广泛适用于教学实验、IoT原型开发及小型智能终端产品预研,尤其适

weixin_34511754的博客 137

Arduino实战指南:I2C协议驱动外置EEPROM的完整实现

本文详细介绍了如何使用Arduino通过I2C协议驱动外置EEPROM,包括硬件连接、Wire库使用、单字节与多字节读写操作,以及实战案例和性能优化技巧。特别适合需要稳定存储数据的Arduino开发者,涵盖从基础到高级的EEPROM应用场景。

weixin_29189373的博客 264

【雕爷学编程】Arduino动手做(68)---AT24C256存储模块

37款传感器与执行器的提法,在网络上广泛流传,其实Arduino能够兼容的传感器模块肯定是不止这37种的。鉴于本人手头积累了一些传感器和执行器模块,依照实践出真知(一定要动手做)的理念,以学习和交流为目的,这里准备逐一动手尝试系列实验,不管成功(程序走通)与否,都会记录下来---小小的进步或是搞不掂的问题,希望能够抛砖引玉。 【Arduino】168种传感器模块系列实验(资料+代码+图形+仿真) 实验六十八:AT24C256 I2C接口 EEPROM 存储模块 IIC AT24C256..

雕爷学编程 2256

STM32实战:麒麟座IIC读写AT24C02 EEPROM全解析(含驱动与避坑)

在嵌入式开发中,I2C总线是最基础也最常用的通信协议之一,仅需两根信号线即可挂载多个从设备,被广泛用于传感器采集、参数存储和配置管理。理解I2C的时序机制——起始、停止、应答、数据传输——是写出稳定驱动的前提。AT24C02作为经典的串行EEPROM,容量小、逻辑简单,非常适合用来验证I2C通信链路是否可靠,也是学习STM32外设驱动和移植的绝佳练习对象。其读写过程覆盖了I2C协议的主要关键点,掌握后就能轻松迁移到其他IIC器件。本文基于麒麟座开发板的STM32F103RET6平台,详细拆解AT24C02的

weixin_29190573的博客 359

AT24C256(EEPROM)读写程序

模拟IO口通信方式下的,与AT24C256(EEPROM)的I2C通信程序

基于stm32f103对AT24C256读写

基于stm32f103,IO模拟IIC总线实现对AT24C256读写操作,对不同系列的AT24CXX适用,只需稍微修改既可以使用。

AT24C01~AT24C256通用读写程序(C51

AT24C01~AT24C256通用读写程序(C51),为AT24C01~AT24C256的读写程序,各人可根据自己的需要应用。 在buf1中填入需要写入的内容,buf2的大小可根据需要定义。 addr可根据使用的芯片选择,可从任何位置读写,只要在该芯片的范围内。 enumer=ATxxx,根据使用的芯片赋值。各函数中的形式参数不需改变。 本程序只要在调用的程序中定义实际参数即可,下述各子程序不必改动

AT24C256 EEPROM 中英文芯片手册

里面含有AT24C256 EEPROM这块芯片的中英文芯片手册各一份,手册里面包含对芯片所有信息的详细介绍,包含对相关引脚的解析和读写操作时序详细说明,可以为大家在学习如何使用这块EEPROM芯片时提供参考。这款芯片的总容量为256kbit,32k byte,整个存储阵列被划分为512页,每页有64个字节。由于芯片手册一般是英文的看起来不爽,所以我也在里面放了中文的芯片手册,初次阅读时可以对照阅读,理解起来速度更快。

at24c256_driver.zip_at24c256_at24c256 读写 程序_at24c64

基于STM32103 AT24C64~256驱动程序

5分钟搞懂双目相机标定:从棋盘格到3D点云的完整流程(附Python代码)

本文详细介绍了双目相机标定的完整流程,从棋盘格准备到3D点云生成,涵盖单目标定、双目标定、立体校正、视差计算等关键步骤。通过Python代码示例,帮助读者快速掌握双目立体视觉技术,实现高精度的3D重建。特别适合机器人导航、工业检测等应用场景。

weixin_29100399的博客 585

从零到一:手把手教你用DaVinci Configurator配置一个完整的AUTOSAR接口通信实例

本文详细介绍了如何使用DaVinci Configurator工具配置AUTOSAR接口通信实例,从环境准备到SWC端口定义、BSW模块配置,再到通信验证的全过程。通过实战案例'车窗控制'功能模块,帮助开发者快速掌握AUTOSAR架构下的接口通信配置技巧,提升汽车电子软件开发效率。

weixin_42557830的博客 450

pikachu靶场: 暴力破解第四关(token防爆破)

Token是服务端生成的一串字符串,以作客户端进行请求的一个令牌,当第一次登录后,服务器生成一个 Token 同时将此 Token 返回给客户端。此外,Token 是有时效的,一段时间之后或下一次请求时用户需要重新验证。

X_shiguang的博客 1720

Cisco Packet Tracer实战:三层交换机链路聚合配置全流程(附常见错误排查)

本文详细解析了在Cisco Packet Tracer环境中配置三层交换机链路聚合的全流程,包括基础网络设置、LACP协议配置、路由协议集成及高级优化技巧。通过实战案例和常见错误排查指南,帮助网络工程师和CCNA备考学员掌握这一提升带宽利用率和实现链路冗余的核心技术。

grafana6viz的博客 228

SECS/GEM协议学习教程

摘要:SECS/GEM是半导体制造设备通信的国际标准,定义了主机系统与设备间的通信规范,包括设备控制、状态监控、数据采集等功能。协议采用分层架构(应用层、消息层、传输层、物理层),支持关键消息类型如S1F13(建立通信)、S2F13(数据采集)等。通信流程涵盖建立连接、数据交换和终止会话,并通过状态变量(SVID)、事件(CEID)等实现实时交互。典型应用包括设备初始化、报警处理及配方管理,需处理数据类型(如U2、A、L)和通信调试问题。

GitHub个人仓库地址:https://github.com/feiyuluoye ; 个人塔罗牌占卜平台:http://118.126.82.12:8080/ ; 欢迎广大Coding友共同交流讨论。 2056

【技术纵览】行为识别前沿模型演进:从CNN到多模态大模型

本文全面解析了行为识别技术从CNN到多模态大模型的演进历程,重点介绍了SlowFast、TimeSformer、VideoMAE和InternVideo等SOTA模型的核心创新与应用实践。通过对比分析各代模型在Kinetics-400等数据集上的表现,揭示了自监督学习和多模态融合如何推动行为识别准确率突破85%,并探讨了工业部署中的技术选型策略与优化方向。

weixin_29169505的博客 153

OpenClaw第2章:快速安装

本章将手把手教你安装 OpenClaw。

Maynor的博客 3236

C#与欧姆龙PLC 通信——Fins Tcp协议

该调试助手专门为了帮助大家学习以及测试Fins-Tcp通信,下面进行详细介绍。

qq_34059233的博客 2081

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

上一篇: esp8266开发笔记3-编译、烧录、运行测试
下一篇: PDF阅读器开关“手型工具阅读文章”功能
芯艺
博客等级 码龄21年 27粉丝 29原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值