Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

24c16 read write help

Status
Not open for further replies.

minhlam

Member level 2
Joined
Nov 15, 2004
Messages
48
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Activity points
323
[video]https://www.youtube.com/playlist?list=PL_4oazPiwX7MaGeF226lWEv24nfmSMk7A[/video]
Dear All..
I would like to learning program 24c16 or 24c256
like as this video on youtube (Please see). But my English is bad and have low basic numeric so I don't know much as him said and have read 24c16 data shell but understand not much.
Therefore Please could you help me to got the code for read and write just only 2 byte to 24c16 and 24c256 and please help me to know the code can use for both 2 chip .Thank you very much in advance.
 

Hi,

How do you want to read/write.
You don't mention a microcontroller, nor a language nor a compiler...

So, how can we help?

Klaus
 

Hi Klaus and all..
Thank you for your ask. Sorry May be my question not clearing. I would
like to program just 2 byte (for easy start leaning) to 24cxx by manual ( by push button) like as video. but I don't know the code for read and write,
exp: X = 1 or 0 (Just for read write 2 byte only)
write: XXXXXX....... ;
read xXXXX .....
Hope you see video * I2C Bit-Banged without Microcontroller! * and understand my question and will help me
Thank you so much
 
Last edited:

There might be an I2C tutorial written in a language you understand better, e.g. french or whatever.

Do you want to operate 24C16 without a microcontroller, as in the video?

I see a problem that a pushbutton can easily send wrong codes (e.g. multiple pulses instead of one) if the contact driving SCL (the I2C clock line) is bouncing.
 

Hi,

this EEPROM has I2C interface. I don´t think it makes sense to read/write the EEPROM with pushbutton.

***
Anyway. If you want to do this, then i recommend to read the datasheet.
There you will find a complete timing diagram with for read and write.

The EEPROM has no dedicated "write command" nor "read command".
For write - according the datasheet - you need to transmit [control byte], [word address], then [data].

****

do you have experience with microcontrollers? and programming?
If so, then try to communicte microcontroller --> EEPROM. Thelearning effect is much higher, because this is a way more real application.

Klaus
 

Hi KlausST Thank you for your time reply.
Hi FvM No problem I will use anti bouncing by schmitt trigger circuit .Please just give me the code read write for 2 byte only Thank you
 

You'll perform the write and read sequences according to 2416 datasheet

start
write 0xa0 (device select write)
write 0x00 (memory address)
write data1
write data2
stop
(wait for end of write operation before performing other actions)

start
write 0xa0 (device select write)
write 0x00 (memory address)
repeated start
write 0xa1 (device select read)
read data1 (ack)
read data2 (nak)
stop
 
Hi FvM
Many thank you for your professional code'
Sincerely
minh
 

No problem I will use anti bouncing by schmitt trigger circuit .
Depending on your circuit around the Schmitt trigger, this will probably not work.
The bounce on a switch is often of the order of several mSec and can be 50mSec or more (depending on the quality of the switch/button).
The majority of Schmitt trigger ICs I have used can switch in the order of uSec or nSec.
Also, a Schmitt trigger will help you when the voltage transition is slow or has a small amount of noise on it. A switch/button bounce will have multiple full voltage swing transitions for a (relatively) long time. Therefore you will still get multiple pulses out of the Schmitt trigger for each switch/button transition.
Look on the Internet for debouncing circuits for a hardware solution, or for debouncing code examples if you are using a microcontroller or similar.
Susan
 
EDBOAR.JPG
You'll perform the write and read sequences according to 2416 datasheet

start
write 0xa0 (device select write)
write 0x00 (memory address)
write data1
write data2
stop
(wait for end of write operation before performing other actions)

start
write 0xa0 (device select write)
write 0x00 (memory address)
repeated start
write 0xa1 (device select read)
read data1 (ack)
read data2 (nak)
stop
Dear FvM and All..
As you know I have very low basic numeric and are learning .So please could you help me again get the The form code below: ( 1 or 0 )
*READ:
Start device select wire memory address REPEATED START device select
..........1010000.....xxxxx......................................................................
read ....... NAK
.....xxxx.............
And to know writing 1 or 0 this code in photo. Hope you understanding me and help,
Sincerely many thank you
minh
 

Minh, the address part is decided by the voltage on the address pins of the IC itself, wiring differently allows you to use several 24C16 in parallel while only only using one of them. For example, if you connect the pins A0, A1 and A2 to ground (000), the address becomes 1010000x = 0xA0 for reading and 0xA1 for writing. If instead you connected A2 to VCC, A1 to ground and A0 to VCC (101) the addresses would be 1010101x = 0xAA for reading, 0xAB for writing.

The word address is the bits to select the address within the memory you want to access, it's the number of the memory location you want to read or write to.

Brian.
 
the address part is decided by the voltage on the address pins of the IC itself
24C16 has no hardware select pins.

regarding address fields in first and second byte, I was assuming that you want to access memory locations 0 and 1. Respectively the address to write is 0, as in my example.
 
Dear betwixt and FvM
First Thank you so much to both for your helpful. Almost in 24c16(e2) datasheet have not an example , so the newbie as me not easy understand for learning. Thanks your support now I understand . Could you help me again to know (give) the code
for WORD ADDRESS in mode PAGE WRITE or other mode , write just 2 bytes for text my understand Please . Thank you again for your time in advance.
 

I did some research and it seems some 24C16 have address pins, some have write protect pins. The 24C16A always has address pins.

Using switches is tedious and prone to human and 'bounce' errors but if you really want to do it, follow the waveform diagrams on the data sheet, using your switches to send either low or high to the SCL and SDA pins. I strongly suggest you use 'pull-down' resistors to ground and connect the switches to VCC so you produce a logic high when the switch is pushed. All you have to do is work out the value you want to send as a binary number then use the timing diagrams to see the order you operate the switches to send the value to the IC one bit at a time. The speed you operate the switches does not matter at all but the order you press them is critical. If you do not follow the correct sequence of high and low on the SCL and SDA pins you will violate the I2C protocol and the operation will fail.

Brian.
 
Dear betwixt and FvM..
Thanks you and FvM and read more on Google now I understand slave and word address of 24c16 and timing scl +sda( but not sure 100%) . Tomorrow I will try write a code for Picaxe chip ( Do High Low wait Lopp ) 1hz ( for easy see led action if device working ) for driver 24c16.
Thank you again to you both for the time support me.
Sincerely
minh
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top