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 using PIC16C5X

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



Joined: 18 Jul 2006
Posts: 103

View user's profile Send private message

I2C using PIC16C5X
PostPosted: Mon Jul 31, 2006 2:16 pm     Reply with quote

I have poored over everything I can find pertaining to I2C. I have not found (or maybe overlooked) any information on using 2 Pins from a 16C5X series to communicate with a Serial EEPROM.

More to the point. I am using a PIC16C57 and 24LC16B EEPROM for storage. Does anyone know of a routine to use - say - PORTB.6 and PORTB.7 as the SCL and SCD pins?

Thanks for any help.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jul 31, 2006 2:30 pm     Reply with quote

Quote:
Does anyone know of a routine to use - say - PORTB.6 and PORTB.7 as the SCL and SCD pins?

CCS has examples for this. Look at the EX_EXTEE.c example file
and the 2416.c driver file. In the example file, you'll have to change
the PIC from a 16C56 to a 16C57.

Also, to change the default pins used by the 2416.c file, you need to
add the following lines shown in bold below:
Quote:

#define EEPROM_SCL PIN_B6
#define EEPROM_SDA PIN_B7

#include <2416.c>


The example file is in this folder: c:\Program Files\Picc\Examples
The driver file is here: c:\Program Files\Picc\Drivers
Ttelmah
Guest







PostPosted: Tue Aug 01, 2006 4:01 am     Reply with quote

As one further comment, if the supplied drivers are not working. The commonest 'mistake' with I2C, is forgetting the pull-up resistors needed on each wire. This happens about once a month here on average. The internal port_b pull-ups, are not enough for I2C to work properly.

Best Wishes
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