• AVR Freaks

Hot!I2C Harmony Example

Author
TomRod
New Member
  • Total Posts : 18
  • Reward points : 0
  • Joined: 2018/10/24 07:18:02
  • Location: 0
  • Status: offline
2019/01/30 07:09:58 (permalink)
0

I2C Harmony Example

Hi everyone, i am a little lost with I2C in Harmony. I read about I2C example given by Harmony called "I2C_RTCC" and it looks pretty hard to understand. Before, i wrote I2C code with plib libraries and it was easy for me but now i must migrate my code to Harmony. Is there an easy code example for read using Harmony and I2C? I hope you can give me hints.
 
Best Regards.
#1
NKurzman
A Guy on the Net
  • Total Posts : 17249
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: I2C Harmony Example 2019/01/30 07:32:07 (permalink)
0
If you want to use your PLIB code you should be able to port it to Harmony. You do not have to use the harmony supplied drivers.
Look at the harmony driver code to find the names of the low level functions. You can use the names you find to find the rest in the Harmony Help document.
It is up to you which path to chose.
#2
jtzeng
Super Member
  • Total Posts : 444
  • Reward points : 0
  • Joined: 2003/11/07 12:42:20
  • Status: offline
Re: I2C Harmony Example 2019/01/30 08:53:34 (permalink)
0
If you are using any Harmony services like USB, File System, TCP or Graphics, I would use the Harmony I2C code as it will maintain the other task service requirements that are needed.
There are very few call that are needed to use the driver:
DRV_I2C_Open(DRV_I2C_INDEX_0, DRV_IO_INTENT_READWRITE);
DRV_I2C_TransmitThenReceive   // write address then read back.
DRV_I2C_TransferStatusGet    // see if operation is done
DRV_I2C_Transmit  // straight write to device.
 
This requires making a small application level state machine for the different actions and waits.
Kind-of an app_i2c_Tasks.
The best area to look is the i2c.h file the description of each call above.
 

John Zigrang
JTZ Engineering, Inc.
#3
Jump to:
© 2019 APG vNext Commercial Version 4.5