Measuring Power Consumption with PAC1934 Step 4: Configure PAC193x MCC Library
Add PAC193x Library to MCC
From the Device Resources window, expand the Pac193xLibrary folder. Add the PAC1934x Library by clicking on the + symbol for PAC193X
Configure I2C Communication
Change the I2C Bus to I2C2.
Check the Overflow Alert Box.
Under the SLOW Register tab, change the Rising Edge and Falling Edge Slow pin to REFRESH. Check the Power On Reset box.
Under the Settings tab, modify the sense resistor values. The PAC1934 Click board uses 4000 uOhms value for all four channels.
Generate the code by clicking the Generate button in the Project Resources window. The Output window in the lower right window will read “Generation complete” if successful.
Add Application Code to main.c
The main.c file needs to be modified to run the application. Open main.c file and add the API App_run() to execute the application code.
Update PAC1934 Header File
Verify, and correct if necessary, the resistor value constants of the PAC1934.h file. Click on the Projects tab in the upper left corner, expand <your MPLAB X IDE project> > Header Files > MCC Generated Files > PAC1934Driver and open PAC1934.h.
Delete the semicolons on the R_SENSE_x definitions (lines 148 – 151).
Compare your MPLAB X IDE project folder structure and files with the following image: