Discussion in "8051 Discussion Forum" started by    sks    Oct 31, 2011.
Fri Nov 04 2011, 01:46 pm
#11
Thanks Mr ExperimenterUK.
I didn't know this "0xa0 is not an address * in* the eeprom it is the address *of* the eeprom."
This was my 1st confusion and second was " 24c04 can only program eight bytes at a time in Page program mode. "
If i write EADDR equ 50h ; this is my eeprom address for writing data
mov EADDR,@r0 ; this R0 is my pointer of RAM data address
inc r0
x
x
x
and after writing 8 bytes of data
if i write mov EADDR+1,@r0. will it do?
Thanks again for clearing doubts, and answering.
sks
Sat Nov 05 2011, 12:14 am
#12
This extract is from the 24c04 data sheet.
"
After generating a START condition, the bus master transmits the slave address
consisting of a 4-bit device code (1010), followed by the
chip address bits A0, A1 and A2. The seventh bit of that
byte (A0) is used to select the upper block (addresses
100—1FF) or the lower block (addresses 000—0FF) of
the array.
The eighth bit of the slave address determines if the
master device wants to read or write to the 24C04A"

Note what the data sheet says about bit (A0) being used to select the upper block
(addresses100—1FF) or the lower block (addresses 000—0FF) of the array.

This is unusual , probably only found on old devices, normally these three bits
are all chip select/address pins.


The 0xa0 byte is made of four parts, the 'a' bit is the device code for eeproms.
most of the '0' is the address of a particular eeprom chip, assuming you connected pins 2 and 3 to ground.
Bit 1 selects upper or lower memory, this may confuse some I2C driver software.
The lowest bit is a read / write bit.
You actually send A0 to write and A1 to read from the eeprom.




and after writing 8 bytes of data
if i write mov EADDR+1,@r0. will it do?

sks


When writing you send the sequence similar to...
(start) a0 address address data,data,data,data,data,data,data,data (stop)

To write the next eight bytes add 8 to the address and do it again
(start) a0 address address+8 data,data,data,data,data,data,data,data (stop)


It is complicated


[ Edited Sat Nov 05 2011, 12:34 am ]
Sat Nov 05 2011, 12:41 am
#13
Dear Mr ExperimenterUK,
Thanks for your help. I will write my fresh code and post. Please continue to help me.
Thanks again
sks
Sat Nov 05 2011, 02:58 am
#14


Dear Mr ExperimenterUK,
Thanks for your help. I will write my fresh code and post. Please continue to help me.
Thanks again
sks

sks


Happy to help

The 24c04 seems to be a bit odd.
Consider changing to the newer types such as the 24lc64.
Some of the smaller, older types have non standard addressing.


[ Edited Sat Nov 05 2011, 03:00 am ]
Sat Nov 05 2011, 10:30 am
#15
Thanks Mr ExperimenterUK,
Good morning. extremely happy for so quick reply.
You wrote " The 0xa0 byte is made of four parts, the 'a' bit is the device code for eeproms.most of the '0' is the address of a particular eeprom chip, assuming you connected pins 2 and 3 to ground." I understand this part completely.

"The lowest bit is a read / write bit." This line is also Clear to me, but
This line " Bit 1 selects upper or lower memory, this may confuse some I2C driver software." This is also confusing me,
I am not able to understand this.
Learning is Learning, one should be clear what he learns. OK
If change my I2C Device from 24C04 to 24C64, will it be easy for me to write the code?
Please answer.
Thanks
sks
Sun Nov 06 2011, 02:20 pm
#16
the sub address depends on the size of memory and it changes as you change your IC. You have to look into datasheet for more help.

here with 24C04A, usage is different.. its like having two 24C02 connected on same bus. with A0 tied to ground for first IC and A0 to VCC for second IC. so you have two addresses 0xA0 and 0xA2 for first 256 byte block and second 256 byte block of 24C04A. I hope you understand now what Phil was trying to say.
Sun Nov 06 2011, 03:53 pm
#17
Dear Mr Ajay,
Thanks for the reply. Now i understand, why people are using 2 separate addresses for addressing a single 24c04. Please calrify
If I write FADDR EQU 0A0H, this means i am addressing to eeprom (24c04) (lower block) then PADDR EQU 90H, is this line means
i am addressing to write/read to this location of 24c04?
If i write FADDR EQU 0A1H is it for upper block of the same eeprom?
After replacing the device from 24c04 to 24c64, In my recent program i am able to write to the eeprom but not able to address to write the location properly, it starts writing from address 00, i dont know why?
Any way i am on the job.
Thanks
sks
Sun Nov 06 2011, 05:45 pm
#18
As i said, for upper block address is 0xA2.

0xA1 is for reading lower block.

for 24c64 is a different IC follow datasheet you will get your answers.
Mon Nov 07 2011, 03:57 am
#19


"The lowest bit is a read / write bit." This line is also Clear to me, but
This line " Bit 1 selects upper or lower memory, this may confuse some I2C driver software." This is also confusing me,
I am not able to understand this.

sks


The240c is very "non standard".
It has 512 bytes of memory, so needs 9 address bits.
Microchip send 8 bits as an address byte,and use one of the bits of the 'A0' byte as
the 9th bit of the address.
So...if we call 'A0' the control byte, bit 0 is R/W.
Bit 1 is the 9th bit of the address and selects high or low 256 bytes of memory.
Bits 2 and 3 match the device address pins on the 2404 (pins 2+3) and select the chip.
Bits 4,5,6+7 are always 'a' to select eeproms.
Simple

In larger devices 2 bytes are used for the address in the command string.


If I write FADDR EQU 0A0H, this means i am addressing to eeprom (24c04) (lower block)

If i write FADDR EQU 0A1H is it for upper block of the same eeprom?

sks


0A0H latches the address that follows into device 0.
0A1H tells eprom 0 to send data.



PADDR EQU 90H, is this line means
i am addressing to write/read to this location of 24c04?

sks


No idea what you are doing here.. probably best not to do it


If change my I2C Device from 24C04 to 24C64, will it be easy for me to write the code?

sks


It should be easier with the larger chips as addressing is clearer.


[ Edited Mon Nov 07 2011, 04:13 am ]
Mon Nov 07 2011, 10:59 am
#20
Dear Mr ExpermenterUK,
Thanks for your help to elaborating so clearly. It is really hard to write 24C04.
After getting tips from Mr Ajay, i could able to write into the lower block or upper block of the memory. Any way i bought some 24C64 from market.
I want to write a code to receive data from serial port and save those at RAM location starts from 30H, then write those data from RAM Locations into the EEPROM 24C64 (this process can be simultaneously done). After resetting the system or resetting the power, micro should read those saved data from 24C64 and write from 30H of RAM location until new data from serial port is received.
Can you guide me by writing a Pseudo code or Algorithm for this?
Thanks
sks

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm
Bernardwarge
Tue Mar 26 2024, 11:15 am