• AVR Freaks

Hot!PIC18F27K42 simpler I2C interface

Author
Doubletop
Starting Member
  • Total Posts : 43
  • Reward points : 0
  • Joined: 2019/03/07 21:46:09
  • Location: 0
  • Status: offline
2021/01/12 01:01:47 (permalink)
0

PIC18F27K42 simpler I2C interface

I was having trouble geting I2C to work on a PC18F27K42. The MCC generated code was way to cumbersome for my needs. @Mysil pointed me to some examples and AN's. With that infoamtion as the basis I offer as simple I2C interface using Chris Best's example, the functions supplied in the MCC I2C_simple_master.C augmented with bitwise functions by Jeff Rowberg's work on the MPU6050
 
https://www.microchip.com/forums/FindPost/1162457
 
Only for PIC18___K42 that have the new I2C peripheral, that so far is used only in _K42, _K83, and _Q43  family devices.
 
Pete
 
 
#1

1 Reply Related Threads

    Doubletop
    Starting Member
    • Total Posts : 43
    • Reward points : 0
    • Joined: 2019/03/07 21:46:09
    • Location: 0
    • Status: offline
    Re: PIC18F27K42 simpler I2C interface 2021/01/17 23:44:28 (permalink)
    0
    I have fixed the read/write 2byte functions. Write now correctly puts the high byte of the 16bit little endian word in the first register and the low byte in the next register. Likewise Read correctly rebuilds the 16bit word to little endian format.
     
    (cant attach again, I have to post the text and then edit and add the attachment)
    post edited by Doubletop - 2021/01/17 23:46:05
    #2
    Jump to:
    © 2021 APG vNext Commercial Version 4.5