• AVR Freaks

Hot!MCC generated I2C code - looking for something it did not generate?

Starting Member
  • Total Posts : 58
  • Reward points : 0
  • Joined: 2020/09/24 07:42:09
  • Location: Washington DC
  • Status: offline
2020/10/09 20:36:29 (permalink)

MCC generated I2C code - looking for something it did not generate?

I'm using MPLAB X IDE v5.40, XC8 compiler v2.30, core v5.0.2. Currently trying on a PIC18F47Q10 but I got the same error with a PIC16F1454. I thought maybe it was because the PIC16 was too old but it's the same error. What's going on?
I use MCC to initialize the pins, oscillator, and added the I2CSIMPLE in Foundation Services. I told it this device would be a Slave among the other settings. Generated the code. Immediately it's looking for 'i2c1_master.h' and this is not available.
With the PIC16 it was looking for 'i2c_master.h' similarly. I couldn't just comment out the references. Is this due to something I'm doing wrong or not doing? Or is it just a bug in this SIMPLEI2C module? There's some code on github that I will try to use for PIC18 instead but I figured I'd try the MCC.

1 Reply Related Threads

    Super Member
    • Total Posts : 3950
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: MCC generated I2C code - looking for something it did not generate? 2020/10/10 04:40:21 (permalink)
    5 (2)
    Most PIC16 and PIC18 devices have very similar I2C peripheral hardware.
    this include PIC16F1454 and  PIC18F47Q10, both with MSSP peripheral module.
    Some PIC microcontrollers have 1 MSSP module, while other have 2 of those.
    When there is more than 1 hardware module in the device, then module index is in function and file names,
    thus the difference between 'i2c_master.h'    and  'i2c1_master.h'.
    I2CSIMPLE in Foundation Services is Master code. I think it will Not help you with Slave code.
    From PIC10 / PIC12 / PIC16 / PIC18 MCUs Device Library v1.78 there have been a big rewrite of I2C code going on,
    among other to be more indepent of Foundation Services.
    I do not know what the state is with MCC core v5.0.2
    While MCC may be good for setting up Pins and PPS, I2C driver code have always been shaky.
    Here is a thread which discuss many of the same problems:
    at the end of the thread, message #26 there is a hint for how to get a Slave code example.
    Jump to:
    © 2020 APG vNext Commercial Version 4.5