Jump to content
Sign in to follow this  
tpcf

Using I2c_driver.h ?

Recommended Posts

I have been trying to use the i2c_driver.h with a PIC 16F877 and a 24LC256 Serial EEPROM. The only way i could get the code to run was to modify the header file so that i could #define an I2C_MODE with the proper parameters (as in the rs232_driver.h) What i did is the following:

 

Replaced

 

////////////////////////////////////////////////////////////////////////////

// i2c hardwareware implementation template arguments

////////////////////////////////////////////////////////////////////////////

#define i2c_ARGS 3, PORTC, TRISC, 4, PORTC, TRISC, e_SSPCON1, e_SSPCON2, \

e_SSPSTAT, e_SSPBUF, e_SSPIF_BIT, e_SSPIF_PIR, \

e_BCLIF_BIT, e_BCLIF_PIR, 7, e_SSPADD, (i2c_reset_wdt | i2c_SMP |i2c_HW)

 

with

 

////////////////////////////////////////////////////////////////////////////

// i2c hardwareware implementation template arguments

////////////////////////////////////////////////////////////////////////////

#define i2c_ARGS 3, PORTC, TRISC, 4, PORTC, TRISC, e_SSPCON1, e_SSPCON2, \

e_SSPSTAT, e_SSPBUF, e_SSPIF_BIT, e_SSPIF_PIR, \

e_BCLIF_BIT, e_BCLIF_PIR, 7, e_SSPADD, I2C_MODE

 

in my program

 

and added

 

#define I2C_MODE (i2c_HW | i2c_SMP)

 

I also commented out the duplicate redefinitions of PORTC and TRISC and remapped all registers for a PIC16F877

 

Is this correct or am i doing something wrong? Any help or feedback would be greatly appreciated

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...