vcpmonitor4 2.0.0.0
Main Page

VCP Monitor 4 click

‍VCP Monitor 4 Click is a compact add-on board that represents a high-precision power monitoring system. This board features the INA239, ultra-precise digital power monitor with a 16-bit delta-sigma ADC specifically designed for current-sensing applications from Texas Instruments.

click Product page


Click library

  • Author : Luka Filipovic
  • Date : Jul 2021.
  • Type : SPI type

Software Support

We provide a library for the VCPMonitor4 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

‍This library contains API for VCPMonitor4 Click driver.

Standard key functions :

Example key functions :

Example Description

‍This example application showcases ability of Click board

to be configured for different readings and read temperature, voltage, current and power.

The demo application is composed of two sections :

Application Init

‍Initialization of communication modules (SPI, UART) and

additional alert pin. Reads Manufacturer and Device ID, Configurates device for reading all device measurements.

void application_init ( void )
{
log_cfg_t log_cfg;
vcpmonitor4_cfg_t vcpmonitor4_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
vcpmonitor4_cfg_setup( &vcpmonitor4_cfg );
VCPMONITOR4_MAP_MIKROBUS( vcpmonitor4_cfg, MIKROBUS_1 );
err_t init_flag = vcpmonitor4_init( &vcpmonitor4, &vcpmonitor4_cfg );
if ( SPI_MASTER_ERROR == init_flag )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
uint32_t temp_data = 0;
log_printf( &logger, " > Manufacturer ID: \t0x%.4X\r\n", temp_data );
log_printf( &logger, " > Device ID: \t\t0x%.4X\r\n", temp_data );
vcpmonitor4_default_cfg ( &vcpmonitor4 );
Delay_ms ( 1000 );
log_info( &logger, " Application Task " );
}
#define VCPMONITOR4_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition vcpmonitor4.h:137
#define VCPMONITOR4_REG_MANUFACTURER_ID
Definition vcpmonitor4.h:89
#define VCPMONITOR4_REG_DEVICE_ID
Definition vcpmonitor4.h:90
#define VCPMONITOR4_SET_DATA_SAMPLE_EDGE
Data sample selection.
Definition vcpmonitor4.h:118
err_t vcpmonitor4_generic_read(vcpmonitor4_t *ctx, uint8_t reg, uint32_t *data_out)
VCP Monitor 4 data reading function.
void application_init(void)
Definition main.c:34

Application Task

‍In span of 500ms reads and calculates data for IC temperature,

Bus voltage in V, Shunt voltage in mV, and current and power for device.

void application_task ( void )
{
float read_data;
vcpmonitor4_get_temperature( &vcpmonitor4, &read_data );
log_printf( &logger, " > Temperature:\t%.2f \r\n", read_data );
vcpmonitor4_get_vbus( &vcpmonitor4, &read_data );
log_printf( &logger, " > Vbus[V]:\t%.2f \r\n", read_data );
vcpmonitor4_get_vshunt( &vcpmonitor4, &read_data );
log_printf( &logger, " > Vshunt[mV]:\t%.2f \r\n", read_data );
vcpmonitor4_get_current( &vcpmonitor4, &read_data );
log_printf( &logger, " > Current[A]:\t%.2f \r\n", read_data );
vcpmonitor4_get_power( &vcpmonitor4, &read_data );
log_printf( &logger, " > Power[W]:\t%.2f \r\n", read_data );
log_printf( &logger, "*************************\r\n" );
Delay_ms ( 500 );
}
err_t vcpmonitor4_get_temperature(vcpmonitor4_t *ctx, float *temperature)
Get device temperature.
err_t vcpmonitor4_get_vshunt(vcpmonitor4_t *ctx, float *vshunt)
Get Shunt voltage.
void application_task(void)
Definition main.c:77

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.VCPMonitor4

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.