30 min

Identify and optimize energy use in appliances with PAC1944 and PIC18LF45K22

Watts up with DC power? Discover the future of energy monitoring

PAC1944 Click with EasyPIC v8

Published Sep 30, 2023

Click board™

PAC1944 Click

Development board

EasyPIC v8


NECTO Studio



Experience the future of power management with our DC energy monitor, designed to simplify energy tracking and optimize your lifestyle



Hardware Overview

How does it work?

PAC1944 Click is based on the PAC1944, a four-channel, bidirectional, high-side current-sensing solution with precision voltage measurement capabilities, DSP for power calculation, and a power accumulator from Microchip Technology. Its real-time calibration minimizes offset and gain errors. Four current sense shunt resistors are connected to PAC1944’s integrated current sense amplifier. Electricity is brought to shunts via screw terminals where the middle screw connector represents GND used for bus voltage monitoring. Bus voltage, sense resistor voltage, and accumulated proportional power are stored in registers for retrieval by the MCU. One major feature of the PAC1944 design is a set of digital comparators that allows the user to detect over/under voltage, over/undercurrent, and overpower against user-programmed limits for each channel and generate an alert when the threshold is exceeded. The digital circuitry of the PAC1944 performs power calculations and energy accumulation, which enables energy monitoring with integration periods of up to one year or longer. After the Start-Up sequence, the

PAC1944 is Active and begins sampling the inputs sequentially. Voltage and current are sampled for all active channels at 1024 samples/second by default, and power is calculated and accumulated. PAC1944 Click communicates with MCU using the standard I2C 2-Wire interface to read data and configure settings, supporting Fast Mode operation with a clock frequency up to 1MHz and High-Speed Mode up to 3.4MHz. Besides, it also allows the choice of the least significant bit of its I2C slave address by positioning the SMD jumper labeled ADDR SEL to an appropriate position marked as 0 and 1. The Power-Down pin, labeled as EN and routed to the CS pin of the mikroBUS™ socket, optimizes power consumption and is used for power on/off purposes. All circuits, including the interface pins, are inactive in this state, and the PAC1944 is in the form of minimum power dissipation. The SLW pin, routed to the RST pin of the mikroBUS™ socket, serves as the conversion rate control. If the SLW pin is asserted, the sample rate is eight samples per second. For sampling rates lower than 1024 samples/second, the PAC1944 is in Sleep mode for a portion of the

conversion cycle, which results in lower power dissipation. No matter the programmed sample rate, this new sample rate will affect the following conversion cycle. The alert functionality, routed to the INT pin of the mikroBUS™ socket, has multiple purposes: to notify the system that a conversion cycle for all active channels is complete, or to inform the system that the accumulator or accumulator count has overflowed, or that an electrical parameter is outside the programmed limit. Besides the INT pin, the SLW pin can function as another alert feature by attaching a pull-up resistor to it, which is done via an onboard SMD jumper labeled as SLW PULL by positioning a 10k resistor to an appropriate position marked as DOWN or UP. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.

PAC1944 Click hardware overview image

Features overview

Development board

EasyPIC v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports many high pin count 8-bit PIC microcontrollers from Microchip, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, EasyPIC v8 provides a fluid and immersive working experience, allowing access anywhere and under any

circumstances at any time. Each part of the EasyPIC v8 development board contains the components necessary for the most efficient operation of the same board. In addition to the advanced integrated CODEGRIP programmer/debugger module, which offers many valuable programming/debugging options and seamless integration with the Mikroe software environment, the board also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.

Communication options such as USB-UART, USB DEVICE, and CAN are also included, including the well-established mikroBUS™ standard, two display options (graphical and character-based LCD), and several different DIP sockets. These sockets cover a wide range of 8-bit PIC MCUs, from the smallest PIC MCU devices with only eight up to forty pins. EasyPIC v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

EasyPIC v8 horizontal image

Microcontroller Overview

MCU Card / MCU




MCU Memory (KB)


Silicon Vendor


Pin count


RAM (Bytes)


Used MCU Pins

mikroBUS™ mapper

Conversion Rate Control
Chip Enable
Power Supply
I2C Clock
I2C Data
Power Supply

Take a closer look


PAC1944 Click Schematic schematic

Step by step

Project assembly

EasyPIC v8 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the EasyPIC v8 as your development board.

EasyPIC v8 front image hardware assembly
GNSS2 Click front image hardware assembly
MCU DIP 40 hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
EasyPIC v8 Access DIPMB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
NECTO Compiler Selection Step Image hardware assembly
NECTO Output Selection Step Image hardware assembly
Necto image step 6 hardware assembly
Necto DIP image step 7 hardware assembly
Necto image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto PreFlash Image hardware assembly

Track your results in real time

Application Output

After pressing the "FLASH" button on the left-side panel, it is necessary to open the UART terminal to display the achieved results. By clicking on the Tools icon in the right-hand panel, multiple different functions are displayed, among which is the UART Terminal. Click on the offered "UART Terminal" icon.

UART Application Output Step 1

Once the UART terminal is opened, the window takes on a new form. At the top of the tab are two buttons, one for adjusting the parameters of the UART terminal and the other for connecting the UART terminal. The tab's lower part is reserved for displaying the achieved results. Before connecting, the terminal has a Disconnected status, indicating that the terminal is not yet active. Before connecting, it is necessary to check the set parameters of the UART terminal. Click on the "OPTIONS" button.

UART Application Output Step 2

In the newly opened UART Terminal Options field, we check if the terminal settings are correct, such as the set port and the Baud rate of UART communication. If the data is not displayed properly, it is possible that the Baud rate value is not set correctly and needs to be adjusted to 115200. If all the parameters are set correctly, click on "CONFIGURE".

UART Application Output Step 3

The next step is to click on the "CONNECT" button, after which the terminal status changes from Disconnected to Connected in green, and the data is displayed in the Received data field.

UART Application Output Step 4

Software Support

Library Description

This library contains API for PAC1944 Click driver.

Key functions:

  • pac1944_setup_config - PAC1944 setup config function

  • pac1944_refresh_cmd - PAC1944 refresh command

  • pac1944_get_calc_measurement - PAC1944 get calculated measurement function.

Open Source

Code example

This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.

 * @file main.c
 * @brief PAC1944 Click example
 * # Description
 * This demo application shows an example of measuring voltage,
 * current and power in a selected part of the circuit. Note that
 * PAC1944 is a high side power monitor, therefore the desired
 * channel should be connected accordingly.
 * The demo application is composed of two sections :
 * ## Application Init
 * Initialization of I2C module, log UART and additional pins.
 * In addition, a default configuration is performed as followed:
 * Sample mode is 1024, adaptive accumulation;
 * INT pin is set as an alert;
 * SLW pin is set as slow sampling rate control;
 * All channels are on;
 * Channel 1 is set for bipolar measurements;
 * Channel 2 is set for bipolar measurements reduced by half;
 * Channel 3 and 4 are set for unipolar measurements.
 * ## Application Task
 * The application sends a refresh command which stores the
 * measurement data in registers. Measurements are acquired
 * for voltage, current and power on channel 1 of PAC1944
 * click board. The last 8 measurements are averaged and
 * calculated in bipolar mode. Process is repeated every
 * two seconds.
 * @author Stefan Nikolic

#include "board.h"
#include "log.h"
#include "pac1944.h"

static pac1944_t pac1944;
static log_t logger;

void application_init ( void ) {
    log_cfg_t log_cfg;  /**< Logger config object. */
    pac1944_cfg_t pac1944_cfg;  /**< Click config object. */

     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.

    pac1944_cfg_setup( &pac1944_cfg );
    PAC1944_MAP_MIKROBUS( pac1944_cfg, MIKROBUS_1 );
    err_t init_flag = pac1944_init( &pac1944, &pac1944_cfg );
    if ( init_flag == I2C_MASTER_ERROR ) {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );

    pac1944_device_state( &pac1944, PAC1944_DEV_ENABLE );
    Delay_ms( 100 );
    pac1944_default_cfg ( &pac1944 );
    log_info( &logger, " Application Task " );
    log_printf( &logger, "-----------------------------\r\n" );
    Delay_ms( 100 );

void application_task ( void ) {
    float voltage_sens;
    float current_sens;
    float power_sens;
    pac1944_refresh_cmd( &pac1944 );
    voltage_sens = pac1944_get_calc_measurement( &pac1944, PAC1944_MEAS_SEL_V_SOURCE,
                                                           PAC1944_MEAS_MODE_BIPOLAR_FSR );
    current_sens = pac1944_get_calc_measurement( &pac1944, PAC1944_MEAS_SEL_I_SENSE,
                                                           PAC1944_MEAS_MODE_BIPOLAR_FSR );
    power_sens = pac1944_get_calc_measurement( &pac1944,   PAC1944_MEAS_SEL_P_SENSE,
                                                           PAC1944_MEAS_MODE_BIPOLAR_FSR );
    log_printf( &logger, "  Voltage :  %.6f   V \r\n", voltage_sens );
    log_printf( &logger, "  Current :  %.6f   A \r\n", current_sens );
    log_printf( &logger, "  Power   :  %.6f   W \r\n", power_sens );
    log_printf( &logger, "-----------------------------\r\n" );
    Delay_ms( 2000 );

void main ( void ) {
    application_init( );

    for ( ; ; ) {
        application_task( );

// ------------------------------------------------------------------------ END

Additional Support