Connect with us

Programming a Digital Current and Power Monitor on PIC18F26K80

Discussion in 'Microcontrollers, Programming and IoT' started by d1ng0, Jul 28, 2021.

Scroll to continue with content
  1. d1ng0

    d1ng0

    8
    0
    Jul 3, 2021
    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?
     
  2. DBingaman

    DBingaman

    108
    28
    Jun 27, 2021
    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?)
     
  3. d1ng0

    d1ng0

    8
    0
    Jul 3, 2021
    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
     
  4. d1ng0

    d1ng0

    8
    0
    Jul 3, 2021
    oio.png
     
  5. DBingaman

    DBingaman

    108
    28
    Jun 27, 2021
    Attached is code for PIC32MX I2C Master. Had to change extension, it is a .c file.
     

    Attached Files:

  6. DBingaman

    DBingaman

    108
    28
    Jun 27, 2021
    If your code is not company proprietary, you could place it on github and I could take a look at it.
     
  7. d1ng0

    d1ng0

    8
    0
    Jul 3, 2021
    Yes , that code is the same that was generated by MCC
     
  8. d1ng0

    d1ng0

    8
    0
    Jul 3, 2021
  9. DBingaman

    DBingaman

    108
    28
    Jun 27, 2021
    Thanks, I will take a look this weekend. I am pretty booked up until then.
     
  10. d1ng0

    d1ng0

    8
    0
    Jul 3, 2021
    You don't need to see it anymore, it's done! Thanks a lot for the help!
     
  11. DBingaman

    DBingaman

    108
    28
    Jun 27, 2021
    Well, I did not help much ;). Just curious what the issue was?
     
  12. d1ng0

    d1ng0

    8
    0
    Jul 3, 2021
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-