vcpmonitor6 2.2.0
Loading...
Searching...
No Matches
vcpmonitor6


VCP Monitor 6 Click

VCP Monitor 6 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Nenad Filipovic
  • Date : Feb 2024.
  • Type : I2C type

Software Support

Example Description

This library contains API for the VCP Monitor 6 Click driver for measurements of the voltage, current, power, energy, charge, and die temperature.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.VCPMonitor6

Example Key Functions

Application Init

The initialization of the I2C module and log UART. After driver initialization, the app sets the default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
vcpmonitor6_cfg_t vcpmonitor6_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
vcpmonitor6_cfg_setup( &vcpmonitor6_cfg );
VCPMONITOR6_MAP_MIKROBUS( vcpmonitor6_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == vcpmonitor6_init( &vcpmonitor6, &vcpmonitor6_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( VCPMONITOR6_ERROR == vcpmonitor6_default_cfg ( &vcpmonitor6 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define VCPMONITOR6_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition vcpmonitor6.h:205
void application_init(void)
Definition main.c:31
@ VCPMONITOR6_ERROR
Definition vcpmonitor6.h:253

Application Task

The demo application reads and displays the results of the input bus voltage, current, power, energy, charge accumulation measurements, and die temperature. Results are being sent to the UART Terminal, where you can track their changes.

void application_task ( void )
{
float app_buf = 0;
if ( VCPMONITOR6_OK == vcpmonitor6_get_bus_voltage( &vcpmonitor6, &app_buf ) )
{
log_printf( &logger, " Voltage: %.2f [V]\r\n", app_buf );
Delay_ms ( 50 );
}
if ( VCPMONITOR6_OK == vcpmonitor6_get_current( &vcpmonitor6, &app_buf ) )
{
log_printf( &logger, " Current: %.2f [mA]\r\n", app_buf );
Delay_ms ( 50 );
}
if ( VCPMONITOR6_OK == vcpmonitor6_get_power( &vcpmonitor6, &app_buf ) )
{
log_printf( &logger, " Power: %.2f [W]\r\n", app_buf );
Delay_ms ( 50 );
}
if ( VCPMONITOR6_OK == vcpmonitor6_get_energy( &vcpmonitor6, &app_buf ) )
{
log_printf( &logger, " Energy: %.2f [kJ]\r\n", app_buf );
Delay_ms ( 50 );
}
if ( VCPMONITOR6_OK == vcpmonitor6_get_charge( &vcpmonitor6, &app_buf ) )
{
log_printf( &logger, " Charge: %.2f [C]\r\n", app_buf );
Delay_ms ( 50 );
}
if ( VCPMONITOR6_OK == vcpmonitor6_get_temperature( &vcpmonitor6, &app_buf ) )
{
log_printf( &logger, " Temperature: %.2f [degC]\r\n", app_buf );
Delay_ms ( 50 );
}
log_printf( &logger, " ----------------------------\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
err_t vcpmonitor6_get_charge(vcpmonitor6_t *ctx, float *charge)
VCP Monitor 6 get the charge function.
err_t vcpmonitor6_get_temperature(vcpmonitor6_t *ctx, float *temperature)
VCP Monitor 6 get the temperature function.
err_t vcpmonitor6_get_energy(vcpmonitor6_t *ctx, float *energy)
VCP Monitor 6 get the energy function.
void application_task(void)
Definition main.c:67
@ VCPMONITOR6_OK
Definition vcpmonitor6.h:252

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.