5
How to interface the 24LC256 EEPROM to Arduino. The 24LC256 EEPROM: The Microchip 24LC256 is a 32K x 8 (256 Kbit) Serial Electrically Erasable P!M" capable o# operatio$ across a broa% &olta'e ra$'e (*+ to 55+) ,t has bee$ %e&elope% #or a%&a$ce%" lo-.  po-er applicatio$s s/ ch as perso$al co00/$icatio$s or %ata ac 1/isitio$ This %e&ice also has a pa'e -rite capability o# /p to 64 bytes o# %ata This %e&ice is capable o#  both ra$%o0 a$% se1/e $tial rea%s /p to the 256K bo/$%ary /$ctio $al a%%ress li$es allo- /p to ei'ht %e&ices o$ the sa0e b/s" #or /p to 2 Mbit a%%ress space This %e&ice is a&ailable i$ the sta$%ar% 8.pi$ plastic ,P" S!,C" TSS!P" MS!P a$% paca'es Feature:  Si$'le S/pply -ith !peratio$ o-$ to 25+ #or 24LC256 e&ices  Lo-.Po-er CM!S Tech$olo'y  7 cti&e c /rre$t 499 /" typical  7 Sta$%by c /rre$t 99 $" typical  2.:ire Serial ,$ter#ace" ,2C; Co0patible  Casca%able /p to Ei'ht e&ices  Sch0itt Tri''er ,$p/ts #or oise S/ppressio$  !/tp/t Slope Co$trol to Eli0i$ate <ro/$% =o/$ce  99 >? a$% 499 >? Cloc Co0patibility  Pa'e :rite Ti0e 5 0s 0ax  Sel#.Ti0e% Erase@:rite Cycle  Pinout: The 24LC256 EEP!M has the pi$o/t sho-$ i$ the #ollo-i$' pict/res

How to Interface the 24LC256 EEPROM to Arduino

  • Upload
    kgoulas

  • View
    223

  • Download
    0

Embed Size (px)

Citation preview

Page 1: How to Interface the 24LC256 EEPROM to Arduino

8/13/2019 How to Interface the 24LC256 EEPROM to Arduino

http://slidepdf.com/reader/full/how-to-interface-the-24lc256-eeprom-to-arduino 1/5

How to interface the 24LC256

EEPROM to Arduino.

The 24LC256 EEPROM:

The Microchip 24LC256 is a 32K x 8 (256 Kbit) Serial Electrically Erasable P!M" capable o#operatio$ across a broa% &olta'e ra$'e (*+ to 55+) ,t has bee$ %e&elope% #or a%&a$ce%" lo-.

 po-er applicatio$s s/ch as perso$al co00/$icatio$s or %ata ac1/isitio$

This %e&ice also has a pa'e -rite capability o# /p to 64 bytes o# %ata This %e&ice is capable o#

 both ra$%o0 a$% se1/e$tial rea%s /p to the 256K bo/$%ary /$ctio$al a%%ress li$es allo- /p toei'ht %e&ices o$ the sa0e b/s" #or /p to 2 Mbit a%%ress space This %e&ice is a&ailable i$ the

sta$%ar% 8.pi$ plastic ,P" S!,C" TSS!P" MS!P a$% paca'es

Feature:

•  Si$'le S/pply -ith !peratio$ o-$ to 25+ #or 24LC256 e&ices

•  Lo-.Po-er CM!S Tech$olo'y

•   7 cti&e c/rre$t 499 /" typical

•   7 Sta$%by c/rre$t 99 $" typical

•  2.:ire Serial ,$ter#ace" ,2C; Co0patible

•  Casca%able /p to Ei'ht e&ices

•  Sch0itt Tri''er ,$p/ts #or oise S/ppressio$

•  !/tp/t Slope Co$trol to Eli0i$ate <ro/$% =o/$ce

•  99 >? a$% 499 >? Cloc Co0patibility

•  Pa'e :rite Ti0e 5 0s 0ax

•  Sel#.Ti0e% Erase@:rite Cycle

 

Pinout:

The 24LC256 EEP!M has the pi$o/t sho-$ i$ the #ollo-i$' pict/res

Page 2: How to Interface the 24LC256 EEPROM to Arduino

8/13/2019 How to Interface the 24LC256 EEPROM to Arduino

http://slidepdf.com/reader/full/how-to-interface-the-24lc256-eeprom-to-arduino 2/5

Pi$s A!" A# and A2 select the ,2C a%%resses"

9 9 2 9 x

So i# yo/ co$$ect pi$s 9" " 2 to < the ,2C a%%ress -ill be 99999 A 9B59 i$

hexa%eci0al

 

The $P pi$ is -rite protectD" set this lo- #or rea%@-rite or hi'h #or rea% o$ly :e are 'oi$' toli$ it to <

Pi$ %cc -ill recei&e the 5+

Pi$ % is the <

&CL and &'A pi$s are the pi$s /se% by the ,2C b/s

 

(nterfacin) with Arduino

To i$ter#ace the 24LC256 chip to r%/i$o , %e&elope% a si0ple boar% /si$' a stripboar%

,t is sho-$ i$ the #ollo-i$' pict/re

Page 3: How to Interface the 24LC256 EEPROM to Arduino

8/13/2019 How to Interface the 24LC256 EEPROM to Arduino

http://slidepdf.com/reader/full/how-to-interface-the-24lc256-eeprom-to-arduino 3/5

,# yo/ %eci%e to b/il% this boar%" re0eber that the copper tracs shall be o$ the botto0 si%e so

-he$ yo/ c/t the tracs yo/ ha&e to 0irror the abpo&e pict/re

 o- yo/ ha&e to co$$ect" -ith so0e -ires" yo/r r%/i$o -ith this boar%

GND <--> GND

DA <--> A4

CL <--> A5

5V <--> 5V

 

Tetin) the *oard

 o- letFs 0ae so0e test" the co%e to %o the test is &ery si0ple

#include <Wire.h> // for I2C

#define i2caddr !5 // de"ice addre for lef$-hand chi% on our

&read&oard

&'$e d() // da$a $o $ore in or read fro* $he ++,

"oid setup01

  Serial.&e3in0521) // Ini$ialie $he erial line

  Wire.&e3in01) // 6a7e u% $he I2C

 

Serial.%rin$ln08Wri$in3 da$a...81)

  for 0in$ i() i<2) i991

 

  6ri$eDa$a0i:i1)

  ;

  Serial.%rin$ln08DN+81)

  Serial.%rin$ln08eadin3 da$a...81)

  for 0in$ i() i<2) i991

 

  Serial.%rin$0i1)  Serial.%rin$08 81)

Page 4: How to Interface the 24LC256 EEPROM to Arduino

8/13/2019 How to Interface the 24LC256 EEPROM to Arduino

http://slidepdf.com/reader/full/how-to-interface-the-24lc256-eeprom-to-arduino 4/5

  d(readDa$a0i1)

  Serial.%rin$ln0d: D+C1)

  ;

  Serial.%rin$ln08DN+81)

;

// 6ri$e a &'$e of da$a in *e*or' loca$ion addr

"oid 6ri$eDa$a0uni3ned in$ addr: &'$e da$a1

  Wire.&e3in=ran*iion0i2caddr1)

  // e$ $he %oin$er %oi$ion

  Wire.6ri$e00in$10addr >> 11)

  Wire.6ri$e00in$10addr ? !@@11)

  Wire.6ri$e0da$a1)

  Wire.end=ran*iion01)

  dela'01)

;

// read a &'$e of da$a fro* *e*or' loca$ion addr&'$e readDa$a0uni3ned in$ addr1

  &'$e reul$)

  Wire.&e3in=ran*iion0i2caddr1)

  // e$ $he %oin$er %oi$ion

  Wire.6ri$e00in$10addr >> 11)

  Wire.6ri$e00in$10addr ? !@@11)

  Wire.end=ran*iion01)

  Wire.reue$@ro*0i2caddr:1) // 3e$ $he &'$e of da$a

  reul$ ( Wire.read01)

  re$urn reul$)

;

"oid loop01

;

 

,# all is -ori$' #i$e the o/tp/t o$ the serial li$e sho/l% be as #ollo-s

 

:riti$' %ataG

!E

ea%i$' %ataG

2 2

Page 5: How to Interface the 24LC256 EEPROM to Arduino

8/13/2019 How to Interface the 24LC256 EEPROM to Arduino

http://slidepdf.com/reader/full/how-to-interface-the-24lc256-eeprom-to-arduino 5/5

-

-

-

B B

DN+