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

I2C CCS example EX_EXTEE

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







I2C CCS example EX_EXTEE
PostPosted: Sat Dec 15, 2007 3:13 pm     Reply with quote

Hello
have anyone tried the I2C to 24xx EEPROM example in CCS on real Hardware,
and did work?
thank you.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Dec 16, 2007 12:13 am     Reply with quote

I tried it just now on a PicDem2-Plus board, with a 24LC256 eeprom.
It worked OK.

To make it work, I had to make these changes to the files:

In the 24256.c file, I changed the SDA and SCL pins to fit the actual
pins used on the PicDem2-Plus board.
Quote:

#ifndef EEPROM_SDA
#define EEPROM_SDA PIN_C4
#define EEPROM_SCL PIN_C3
#endif


In the Ex_extee.c file, I changed the eeprom driver file to 24256.c,
as shown in bold below:
Quote:

#include "input.c"
#include "24256.c"


Then I compiled and programmed it into the PIC and ran it.
Be aware that for a 24LC256, you must type 4 digits for the address.
In the example below, I typed "0000", because I wanted to write 0x55
to the first address in the eeprom. Then I read it back, and it gave
the correct result. I tested it with vs. 4.064 of the compiler.
Quote:

Read or Write: W
Location: 0000
New value: 55

Read or Write: R
Location: 0000
Value: 55

Read or Write:


If this doesn't work, a very common error is to leave off the pull-up
resistors on SDA and SCL. The pull-ups must be in there. It's part of
the i2c bus specification. You can use 4.7K ohm resistors.

Links to other, more simple, eeprom test programs are shown in this
thread.
http://www.ccsinfo.com/forum/viewtopic.php?t=33034
ZeRon



Joined: 15 Dec 2007
Posts: 6

View user's profile Send private message

PostPosted: Tue Dec 18, 2007 1:14 pm     Reply with quote

Thx a lot PCM programmer actually a was trying it on proteus simulator but it was not working ,well but now I bought a 24LC64 and tried it on real hardware and voila everything is working great .I think as much as proteus is helpful , sometimes it gives you some trouble.
thx again
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