Step 4: Configure PAC193x MCC Library

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

Picture29.jpg

Step 4.2: Configure I2C Communication

Change the I2C Bus to I2C2.

PAC1934SettingI2C2v2.png

Check the Overflow Alert Box.

PAC1934SettingOverflowv2.png

Under the SLOW Register tab, change the Rising Edge and Falling Edge Slow pin to REFRESH. Check the Power On Reset box.

Picture31v2.jpg

Under the Settings tab, modify the sense resistor values. The PAC1934 Click board uses 4000 uOhms value for all four channels.

Picture32v2.jpg

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.

Generatecodesuccess.png

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.

While1.png

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).

Picture33.jpg

Compare your MPLAB X IDE project folder structure and files with the following image:

FinalProject.png
© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.