CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Configuring I2C Routine for EEPROM IC (24xx00)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
liche
Guest







Configuring I2C Routine for EEPROM IC (24xx00)
PostPosted: Thu Apr 24, 2003 9:06 am     Reply with quote

Just some simple questions regarding the interface from a PIC16C66 to a 24xx00 EEPROM via I2C.

1. Is the following statement correct regarding proper set-up?

#USE I2C (master, SDA=PIN_B2, SCL=PIN_B3)

The 24xx00 does have a slave address of (1010). Do I need to use this address in the above statement???

2. I noticed in some examples such as:

i2c_start();
i2c_write(0xa0); //address
i2c_write(0x55); //data
i2c_stop();

that there seems to be no provision regarding the sending of a control byte. Is this done internally, or do I need to provide this control byte as well???

For example, for the 24xx00 EEPROM, the control byte looks like:

S 1 0 1 0 X X X

Where s=start bit, Device Select bit is 1010, and the last three bits are don't care.

Any help appreciated.
Thanks
Liche
___________________________
This message was ported from CCS's old forum
Original Post ID: 13973
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Configuring I2C Routine for EEPROM IC (24xx00)
PostPosted: Thu Apr 24, 2003 11:19 am     Reply with quote

:=Just some simple questions regarding the interface from a PIC16C66 to a 24xx00 EEPROM via I2C.
:=
:=1. Is the following statement correct regarding proper set-up?
:=
:=#USE I2C (master, SDA=PIN_B2, SCL=PIN_B3)

Yes, this is OK.

:=
:=The 24xx00 does have a slave address of (1010). Do I need to use this address in the above statement???

No.

:=
:=2. I noticed in some examples such as:
:=
:=i2c_start();
:=i2c_write(0xa0); //address
:=i2c_write(0x55); //data
:=i2c_stop();
:=
:=that there seems to be no provision regarding the sending of a control byte. Is this done internally, or do I need to provide this control byte as well???

The "0xa0" is the control byte.

Use 0xa0 for a write operation and 0xa1 for a read operation.

Here is a CCS example file for the 2402 eeprom:
<a href="http://ms-n.org/DataSheets/ccs/examples/2402.C" TARGET="_blank">http://ms-n.org/DataSheets/ccs/examples/2402.C</a>

You can look at each line in the example program, and compare
it to the diagrams shown in the data sheet. Also, be sure
to note that the last read operation requires a NACK, which
is done by using a 0 parameter with the i2c_read() function.
You can see this in Figure 8-1 of the data sheet, where it
says "NO ACK". Use "i2c_read(0)" to do that.
Also, notice the "delay_ms(11)" statement at the end of
a write function. That delay allows time for the eeprom to
do the physical write operation.

Here is the data sheet:
<a href="http://www.microchip.com/download/lit/pline/memory/ic/21178c.pdf" TARGET="_blank">http://www.microchip.com/download/lit/pline/memory/ic/21178c.pdf</a>
___________________________
This message was ported from CCS's old forum
Original Post ID: 13978
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group