xjl1227 发表于 2009-11-18 19:02:37

AT24C02的许多疑惑不解??高手来解答下。。

型号       容量    页               页面写入字节/字节/页    控制码    片选   读/写      总线访问器件
AT24C02    2KB    8字节/页,256页      8                      1010      A2A1A01/0       8


问题:
ATMEGA16内部EEPROM为512B,地址为0~511,请问24C02地址为多少?
始终不理解片选是干嘛用的,如果我只选A1A0,不选A2,出现什么现象?
写地址是0xa0,
读地址是0xa1,难道A2A1A0一定要等于0吗?

搞不明白,不如内部EEPROM直接明了,512字节对应地址0~511,一个地址编号对应一个字节,直接明了,
24C02怎么存储的???

little_Monkey 发表于 2009-11-18 19:28:37

A2A1A0都接地是为了方便,其他问题都是一个问题 ,仔细看下手册就明白了 ,PS,菜鸟路过

lusson 发表于 2009-11-18 19:54:47

不仔细看手册?

xjl1227 发表于 2009-11-18 20:11:35

我想知道AT24C02有256页,一页8字节,总共2KB,
首地址肯定是0x00,尾地址是多少??

楼上的别老拿数据手册来压人,手册也是人写的,不可能详细地写出每一样知识点。

helloshi 发表于 2009-11-18 20:17:30

255

marx 发表于 2009-11-18 20:20:20

A0、A1、A2是为了并联用的,你可以把8个24C02挂在同一条I2C接口上,公用SDA、SCL两条线,至于选用那一片24C02,可以通过设置A0、A1、A2的外部电平,让每片都不同。

至于你其他的问题,Datasheet里面很清楚了没必要解释。

xjl1227 发表于 2009-11-18 20:51:24

还是无法理解,
我得请高手解释一下一个概念,“什么是页”。
难道像翻书一样一页一页这样形容,
是不是0页有255字节,1页上有255字节??
如果这样倒还好理解了,
但是我看到程序中函数
void eeprom_write(unsigned int address,unsigned int data)
void eeprom_read(unsignedint address)
直接给出一个地址这样定义,
所以我估计那样‘页’的理解是有误的吧?
所以我才这样问
“我想知道AT24C02有256页,一页8字节,总共2KB,
首地址肯定是0x00,尾地址是多少??”

数据手册不是那么好理解的,写操作方式中有字节写和页写2种方式,读操作方式有3种,怎么用没说,只是介绍而已。
请高手帮忙理解。。。如果一个数存在255的地址上,那么下一个数会存到哪里呢?

czzhouyun 发表于 2009-11-18 23:27:07

这么解释吧,8字节一页就是说写到第9字节时就把第一字节给覆盖了,必须要换页(重新指定首地址)

zhxzhx 发表于 2009-11-18 23:50:56

看数据手册,是一种技能,要多练习的,关于这个器件的一切知识点,真的都来源于数据手册
你把他的页.理解成C的二维数组就可以了,二维数组是可以当一维用的,这就是按字节读写,当二维用就是按页读写

仅便于理解,不完全正确,比如环绕...

xjl1227 发表于 2009-11-19 09:53:10

我参考了马潮老师关于AT24C256(32KB)的介绍,有点明白,

AT24C02的存储器为2KB,分成256页,每页8字节,那么地址空间为0~7FFH单元,地址长度为11位,用2字节表示,
低三位表示页内偏移量(0~7),高八位表示页码(0~255),

这样解释应该对了吧?
高手们都没讲到这一层。。所以不明白。。

kebaojun305 发表于 2009-11-19 10:04:45

AT24C02的存储器为2K位,不是字节,它是由32页组成,每个页8个字节。数据手册有,你没有仔细看而已:
在数据手册的第一页和第三页
Features
• Low-voltage and Standard-voltage Operation
–2.7 (VCC = 2.7V to 5.5V)
–1.8 (VCC = 1.8V to 5.5V)
这里也有。
• Internally Organized 128 x 8 (1K), 256 x 8 (2K), 512 x 8 (4K
1024 x 8 (8K) or 2048 x 8 (16K)


Pin Description SERIAL CLOCK (SCL): The SCL input is used to positive edge clock data into each
EEPROM device and negative edge clock data out of each device.
SERIAL DATA (SDA): The SDA pin is bidirectional for serial data transfer. This pin is
open-drain driven and may be wire-ORed with any number of other open-drain or open-
collector devices.


DEVICE/PAGE ADDRESSES (A2, A1, A0): The A2, A1 and A0 pins are device
address inputs that are hard wired for the AT24C01A and the AT24C02. As many as
eight 1K/2K devices may be addressed on a single bus system (device addressing is
discussed in detail under the Device Addressing section).
The AT24C04 uses the A2 and A1 inputs for hard wire addressing and a total of four 4K
devices may be addressed on a single bus system. The A0 pin is a no connect and can
be connected to ground.
The AT24C08A only uses the A2 input for hardwire addressing and a total of two 8K
devices may be addressed on a single bus system. The A0 and A1 pins are no connects
and can be connected to ground.
The AT24C16A does not use the device address pins, which limits the number of
devices on a single bus to one. The A0, A1 and A2 pins are no connects and can be
connected to ground.
WRITE PROTECT (WP): The AT24C01A/02/04/08A/16A has a Write Protect pin that
provides hardware data protection. The Write Protect pin allows normal Read/Write
operations when connected to ground (GND). When the Write Protect pin is connected
to VCC, the write protection feature is enabled and operates as shown in Table 2.
Table 2.Write Protect

Memory Organization

AT24C01A, 1K SERIAL EEPROM: Internally organized with 16 pages of 8 bytes each,
the 1K requires a 7-bit data word address for random word addressing.
这里写着呢。
AT24C02, 2K SERIAL EEPROM: Internally organized with 32 pages of 8 bytes each,
the 2K requires an 8-bit data word address for random word addressing.
AT24C04, 4K SERIAL EEPROM: Internally organized with 32 pages of 16 bytes each,
the 4K requires a 9-bit data word address for random word addressing.
AT24C08A, 8K SERIAL EEPROM: Internally organized with 64 pages of 16 bytes
each, the 8K requires a 10-bit data word address for random word addressing.
AT24C16A, 16K SERIAL EEPROM: Internally organized with 128 pages of 16 bytes
each, the 16K requires an 11-bit data word address for random word addressing.

xjl1227 发表于 2009-11-19 11:04:13

本来没什么疑问了,看了10楼的说法,又不解了,
照你的意思是AT24C02存储空间为256字节,32页
但是我的参考书上是2K字节,256页,
我再找找其他资料看看哪个对??

ivws 发表于 2009-11-19 11:12:30

2K 单位不是字节,是bit

每字节为8bit

1024 * 2 / 8 = 256字节

每页8字节 256 / 8 = 32页

ivws 发表于 2009-11-19 11:15:49

AT24C02在容量只有256字节.地址只有一个字节数据.

0712 发表于 2009-11-19 11:24:47

一看到标题,就想到楼主肯定是理解2KB不透彻了
A0A1A2是在总线上器件的地址

xjl1227 发表于 2009-11-19 11:26:38

查阅了很多资料,确实10楼的说法正确,
那么参考书上的一些说法错了,
《手把手教你学AVR单片机C程序设计》 周兴华 编著 北航出版社
P335 各种EEPROM的容量、页数是错的,大家注意了。

不过错有错着,让我加深了认识。。+5楼、9楼、10、11楼的理解,明白了。。

zenghao616 发表于 2011-8-14 00:19:06

楼主我不解了看了这个帖子
最近我也在写24C02
1.这个2K到底是字节还是位?
2.我在字节写的时候,如果地址位是八位那就是说可以寻址256个字节,但是如果大于2K的容量,这个是不是就要地址分为高地位写进去。你的9楼的回复“低三位表示页内偏移量(0~7),高八位表示页码(0~255)” ,回到第一个问题,到底是256页还是32页

cwxdjh521 发表于 2011-8-14 00:24:18

回复【16楼】zenghao616
----------------------------------------------------------------------
现在电脑内存一般都是2G,你理解了这2G到底是指什么你就明白了

scfor 发表于 2011-8-30 17:01:24

24C02 就1页好不好,256个字节,8个位00-FF就足够找到了,24C04是2页,24C08是4页,24C16是8页,就这么简单

TonyNoodleLee 发表于 2011-9-1 11:42:32

24C02的02是2K bit的意思,也就是256字节嘛,哪有那么多!!!!

zfzdhz_2012 发表于 2012-10-1 19:15:13

czzhouyun 发表于 2009-11-18 23:27 static/image/common/back.gif
这么解释吧,8字节一页就是说写到第9字节时就把第一字节给覆盖了,必须要换页(重新指定首地址) ...

可以这么理解:
比如说AT24C04(512字节),
16字节每页(AT24C04是8字节每页),
512字节/16=32页,

若存放少于16或等于16字节,页地址不需要变,
若超过16字节,则超过的字节读出来是0XFF,并且从第一个字节开始覆盖。


页: [1]
查看完整版本: AT24C02的许多疑惑不解??高手来解答下。。