Step 4.1: Add PAC193x Library to MCC
Note: The PAC193x MCC library provides an easy-to-use graphical interface to configure the various options of the PAC1934 Click Board.
From the Device Resources window, expand the Pac193xLibrary folder. Add the PAC1934x Library by clicking on the + symbol for PAC193X
Step 4.2: 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.
Note: MCC generates source and header files based on selections made in the GUI. The generated files are added to the active project of MPLAB X IDE.
Step 4.3: 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.
Step 4.4: 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: