• AVR Freaks

I2C Library PIC18F4550

Author
pierreke101
New Member
  • Total Posts : 13
  • Reward points : 0
  • Joined: 2016/12/02 03:23:33
  • Location: 0
  • Status: offline
2017/03/02 06:36:19 (permalink)
0

I2C Library PIC18F4550

Hello,
 
It's my first time using a PIC and programming it and I have some questions about I2C library's.
Where can I find a library for I2C for my PIC18F4550?
Or where can I find a guidline?
 
After searching I found a lot of different things but I don't know what is what.
 
Thanks
#1

12 Replies Related Threads

    CinziaG
    die fucking humans
    • Total Posts : 3144
    • Reward points : 0
    • Joined: 2016/12/07 14:20:36
    • Location: Wien
    • Status: offline
    Re: I2C Library PIC18F4550 2017/03/02 07:02:17 (permalink)
    +1 (1)
    MAster or slave?
    HW or SW (bit-banged)?
     
    Searching the forum with google should give you many examples
     

    in 2018 you signed for your annihilation. in 2019 it will come ;) I promise
    my most wonderful creations here
    https://www.youtube.com/c...dPFRvtwsbSTXp6Sk6azGOQ
    #2
    pierreke101
    New Member
    • Total Posts : 13
    • Reward points : 0
    • Joined: 2016/12/02 03:23:33
    • Location: 0
    • Status: offline
    Re: I2C Library PIC18F4550 2017/03/02 07:05:34 (permalink)
    +1 (1)
    It's for the master.
    I do not really know if its hardware of software... It's for an I/O expander (PCA9505)
    How can I know which one it is?
     
    Thank you CinziaG
    post edited by pierreke101 - 2017/03/02 07:08:08
    #3
    NKurzman
    A Guy on the Net
    • Total Posts : 17709
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: I2C Library PIC18F4550 2017/03/02 07:25:32 (permalink)
    +2 (2)
    The question was are you using the built in peripheral or the Software/ bit banged approach.
    You can use the Hardware approach if you are connected to the right pins on the PIC
    #4
    pierreke101
    New Member
    • Total Posts : 13
    • Reward points : 0
    • Joined: 2016/12/02 03:23:33
    • Location: 0
    • Status: offline
    Re: I2C Library PIC18F4550 2017/03/02 07:48:56 (permalink)
    +1 (1)
    I'm connected to the right pins so it will be hardware.
    #5
    katela
    Super Member
    • Total Posts : 1379
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: I2C Library PIC18F4550 2017/03/02 08:33:07 (permalink)
    +2 (2)
    MCC doesn't include PIC18F4550 at the moment, but you can use PIC18F Peripheral Libraries with your PIC. They are now called PIC18F Legacy Peripheral Libraries. you have to install them separately 
    post edited by katela - 2017/03/02 08:41:27

    Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
    YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
    #6
    CinziaG
    die fucking humans
    • Total Posts : 3144
    • Reward points : 0
    • Joined: 2016/12/07 14:20:36
    • Location: Wien
    • Status: offline
    Re: I2C Library PIC18F4550 2017/03/02 12:17:47 (permalink)
    0
    You're a Master, then Smile (in electronics terms)
     
    You can still use SW solution even on those pins - personally I find that approach easier.

    in 2018 you signed for your annihilation. in 2019 it will come ;) I promise
    my most wonderful creations here
    https://www.youtube.com/c...dPFRvtwsbSTXp6Sk6azGOQ
    #7
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: I2C Library PIC18F4550 2017/03/02 14:33:57 (permalink)
    +2 (2)
    CinziaG
    ..
    You can still use SW solution even on those pins - personally I find that approach easier.
    ...

    Ahhh, but that's because you're a Master ;)
     
    #8
    CinziaG
    die fucking humans
    • Total Posts : 3144
    • Reward points : 0
    • Joined: 2016/12/07 14:20:36
    • Location: Wien
    • Status: offline
    Re: I2C Library PIC18F4550 2017/03/02 14:39:26 (permalink)
    0
    qhb
    CinziaG
    ..
    You can still use SW solution even on those pins - personally I find that approach easier.
    ...

    Ahhh, but that's because you're a Master ;)
     




    Ahah grin no well, it depends. But SW approach is more portable, and free from quirks and unknown issue from the hardware... (and it will also never hang)

    in 2018 you signed for your annihilation. in 2019 it will come ;) I promise
    my most wonderful creations here
    https://www.youtube.com/c...dPFRvtwsbSTXp6Sk6azGOQ
    #9
    Mysil
    Super Member
    • Total Posts : 3330
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: I2C Library PIC18F4550 2017/03/02 18:32:34 (permalink)
    +4 (4)
    Hi,
    As late as 2 weeks ago, there was a thread that ended up with some example code for I2C Master,
    using the I2C hardware peripheral in PIC18 and Plib functions, updated to work with current versions of XC8:
    http://www.microchip.com/forums/FindPost/975571
     
    The code in the example there use the MSSP hardware in PIC18, and wait for each operation to complete,
    before the program continue.
     
    The code was first written for PIC18F6723, and was tested on PIC18F26K22 when debugging.
    PIC18F4550 is not much different from these devices in I2C Master mode,
    but have only one MSSP hardware module, so function names used for I2C operations will need to be different.
     
    Regards,
       Mysil
    #10
    pierreke101
    New Member
    • Total Posts : 13
    • Reward points : 0
    • Joined: 2016/12/02 03:23:33
    • Location: 0
    • Status: offline
    Re: I2C Library PIC18F4550 2017/03/03 14:22:16 (permalink)
    0
    Thank you everyone for your response.
     
    It's still not 100% clear to me what I should use and how exactly.
    I'm using MPLAB IDE V8.60 and using PICKit 3 to upload my code but I saw that the compiler I use also matter.
    But how can I now which compiler I'm using?
     
    Anyone who knows an example for the PIC18F4550 with I2C communication?
    I undrstand I2C and I know how to program it but I don't really find the proper library's/files I need.
     
    In the ZIP you can find the code I already wrote in MPLAB for my PIC18F4550, it's a simple demo for communicating with a PC true USB but I also need to communicate true I2C to my IO expander.
     
    Regards,
    #11
    Mysil
    Super Member
    • Total Posts : 3330
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: I2C Library PIC18F4550 2017/03/03 16:10:28 (permalink)
    +1 (1)
    You are way behind!
    The last version of MPLAB 8 was v8.92. It is still useable, but no longer updated. You should update from 8.60.
    It may be downloaded from Microchip downloads archive webpage.
    http://www.microchip.com/development-tools/downloads-archive
     
    Don't know what compiler and version you are using?
    MPLAB report it in the Output window for every file it compile!
    There are some reasons you may prefer to stay with compiler XC8 v1.33.
     
    For I2C, there are several possibilities, but all of them have bugs or snags of some kind.
    There are example code in: EmbeddedcodeSource, and in various tutorial sites around the web.
     
    Regards,
       Mysil
     
    #12
    paulfjujo
    paulfjujo
    • Total Posts : 71
    • Reward points : 0
    • Joined: 2011/03/08 05:33:46
    • Location: France 01700
    • Status: online
    Re: I2C Library PIC18F4550 2017/03/04 02:57:31 (permalink)
    0
    hello,
     
     
    my config MPLAB IDE  version 8.92
    Language tool versions: mpasmwin.exe v5.44, mplink.exe v4.42, mcc18.exe v3.41, mplib.exe v4.42
    C compiler :  MPLAB C18 v3.41 
    for me , this old version is more easy to use than new MPLAB.X wich take very big place and a lot of files
    compare to the compact solution with MPLAB IDE + C18.
    if you don't use rescent MCU ..(not supported by MPLAB IDE + C18)
     
    for New MCU devices , i prefer to use MikroC.
    #13
    Jump to:
    © 2019 APG vNext Commercial Version 4.5