Maker Pro
Maker Pro

Programming a Digital Current and Power Monitor on PIC18F26K80

d1ng0

Jul 3, 2021
8
Joined
Jul 3, 2021
Messages
8
Hi, I'm on a project where I would like to measure a battery voltage. For that, I have to use a Digital Current and Power Monitor, called INA260. I already have a board made and it's functional because I've already tested it with the arduino, but I'm not able to do the programming on the PIC18F26K80. Can anyone help me?
 

DBingaman

Jun 27, 2021
103
Joined
Jun 27, 2021
Messages
103
I have programmed the PIC32MX devices using C. I have a feeling this is not much different. You have a few options. You can use the 'Harmony Library' or you can program it directly in 'C'. I am not a fan of the Harmony Library.
I see the part is I2C, I have programmed PIC's for I2C before.
Please provide the full schematic. Also, do you have a programmer (PICKIT-3 or PICKIT-4?)
 

d1ng0

Jul 3, 2021
8
Joined
Jul 3, 2021
Messages
8
I created the I2C library using the MPLAB® Code Configurator then I made the C code by hand but I still can't get the values properly
 

DBingaman

Jun 27, 2021
103
Joined
Jun 27, 2021
Messages
103
I created the I2C library using the MPLAB® Code Configurator then I made the C code by hand but I still can't get the values properly
I created the I2C library using the MPLAB® Code Configurator then I made the C code by hand but I still can't get the values properly
I created the I2C library using the MPLAB® Code Configurator then I made the C code by hand but I still can't get the values properly
Attached is code for PIC32MX I2C Master. Had to change extension, it is a .c file.
 

Attachments

  • I2CMaster.txt
    10 KB · Views: 2

DBingaman

Jun 27, 2021
103
Joined
Jun 27, 2021
Messages
103
If your code is not company proprietary, you could place it on github and I could take a look at it.
 

d1ng0

Jul 3, 2021
8
Joined
Jul 3, 2021
Messages
8
Yes , that code is the same that was generated by MCC
 

DBingaman

Jun 27, 2021
103
Joined
Jun 27, 2021
Messages
103
Thanks, I will take a look this weekend. I am pretty booked up until then.
 

d1ng0

Jul 3, 2021
8
Joined
Jul 3, 2021
Messages
8
You don't need to see it anymore, it's done! Thanks a lot for the help!
 
Top