|
|
View previous topic :: View next topic |
Author |
Message |
ZYX Guest
|
I2C CCS example EX_EXTEE |
Posted: Sat Dec 15, 2007 3:13 pm |
|
|
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
|
|
Posted: Sun Dec 16, 2007 12:13 am |
|
|
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
|
|
Posted: Tue Dec 18, 2007 1:14 pm |
|
|
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 |
|
|
|
|
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
|