Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I2C Communication between two PIC18 microcontroller

Status
Not open for further replies.

pjohn

Newbie level 6
Joined
Oct 23, 2010
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,383
Dear All,

I am looking for an example project or tutorial that utilizes C language or Microchip Library to configure two PIC 18 using I2C. Any help or direction will be highly appreciated.

Best Regards
 

  • Like
Reactions: pjohn

    pjohn

    Points: 2
    Helpful Answer Positive Rating
Thanks very much for your help
 

The example code need the MCC18 compiler library, but I am using the PIC18F45K22, I found that it is not supported by the MCC18 library.....
I will try to #define I2C_V6 in my code to use the "i2c.h" library

Also, in the example code, why it does not need to send stop bit to terminate the communication?


Thanks
 
Last edited:

have you downloaded the latest version of MPLAB and MCC18 ?
**broken link removed**

my version of mcc18 picks up the include OK
Code:
#include <p18F45K22.h>
 
Last edited:

The required subroutine is not in pic18f45k22.h.
They are in i2c.h and pcconfig.h (in C:\MCC18\h)(I attached here with .txt extension)

In the pcconfig.h, the code is like:
Code:
#ifdef   __18F65K22
     #define I2C_V6_1
There is no __18F45K22...

and in i2c.h, the code is:
Code:
#ifdef I2C_V6_1
... 
... //I2C function
...

I tried to add a code in my main.c to use the function in the i2c.h:
Code:
#include  <i2c.h>
#define I2C_V6

but I get an error message :
main.c:308:Warning [2058] call of function without prototype
 

Attachments

  • i2c.txt
    31.2 KB · Views: 106
  • pconfig.txt
    291.5 KB · Views: 61

which function has no prototype?
you can usually ignore the warnings, if the project builds OK try to load and run it
 

I choose to rewrite the function in my project.

Btw, in your example code, why it does not need to send stop bit to terminate the communication?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top