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 CCS Technical Support

i2c 24c256 ex_extee.c setup_spi(FALSE)

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



Joined: 22 Feb 2004
Posts: 1

View user's profile Send private message

i2c 24c256 ex_extee.c setup_spi(FALSE)
PostPosted: Sun Feb 22, 2004 11:13 pm     Reply with quote

Hi,

[frank@picard frank]$ ccsc +v
PCM compiler version 3.168 (linux, RH9)

I was running some test code from PCM programmer 24lc256.c
on a pic16f876 and 24c256 eeprom via i2c.

All is well, thanks for the example code.

Now the strange part (or maybe I am tired).

if i run ex_extee.c, reads and writes do not work
reads return 0xff and writes hang.

however if I add 1 extra line after init_ext_eeprom

init_ext_eeprom(); <-- existing line, no change

setup_spi(FALSE); // added by me - program now works ... aaarrgh !!!!!!

then it all works.

I have read some discussions about using setup_spi(FALSE); so
now I am confused.

Has anyone else seen this ??

Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 23, 2004 12:34 am     Reply with quote

Quote:
if i run ex_extee.c, reads and writes do not work
reads return 0xff and writes hang.

I'm not familiar with the Linux version, but here are my thoughts:

I assume that you have edited the EX_EXTEE.C file, to #include
the CCS driver file, 24256.C.

I assume that you are using pins C4 and C3 for SDA and SCL.

So, in the EX_EXTEE.C file, place the following lines above the
line for #include <24256.c>

#define EEPROM_SDA PIN_C4
#define EEPROM_SCL PIN_C3

Example:
Code:
#define EEPROM_SDA  PIN_C4
#define EEPROM_SCL  PIN_C3
#include <24256.c>


See if that makes a difference.
Guest








PostPosted: Mon Feb 23, 2004 9:22 pm     Reply with quote

PCM programmer wrote:
Quote:
if i run ex_extee.c, reads and writes do not work
reads return 0xff and writes hang.

I'm not familiar with the Linux version, but here are my thoughts:

I assume that you have edited the EX_EXTEE.C file, to #include
the CCS driver file, 24256.C.

I assume that you are using pins C4 and C3 for SDA and SCL.

So, in the EX_EXTEE.C file, place the following lines above the
line for #include <24256.c>

#define EEPROM_SDA PIN_C4
#define EEPROM_SCL PIN_C3

Example:
Code:
#define EEPROM_SDA  PIN_C4
#define EEPROM_SCL  PIN_C3
#include <24256.c>


See if that makes a difference.


Yep, I had previously tried as you have mentioned. I know the pins are ok as
the code works once I add setup_spi(FALSE); Hmm thanks anyway.

The only thing I can think of is that perhaps the latest Linux CCSC release is
3.168 while the latest windows version is 3.185 and maybe there are some
bug fixes I am missing. I have enquired about the difference to CCS but no
answer thus far.

Cheers / Frank Very Happy
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