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
- vcpmonitor6_cfg_setup Config Object Initialization function.
void vcpmonitor6_cfg_setup(vcpmonitor6_cfg_t *cfg)
VCP Monitor 6 configuration object setup function.
VCP Monitor 6 Click configuration object.
Definition vcpmonitor6.h:235
- vcpmonitor6_init Initialization function.
err_t vcpmonitor6_init(vcpmonitor6_t *ctx, vcpmonitor6_cfg_t *cfg)
VCP Monitor 6 initialization function.
VCP Monitor 6 Click context object.
Definition vcpmonitor6.h:218
- vcpmonitor6_default_cfg Click Default Configuration function.
err_t vcpmonitor6_default_cfg(vcpmonitor6_t *ctx)
VCP Monitor 6 default configuration function.
- vcpmonitor6_get_bus_voltage This function reads the BUS voltage output measurement in volts [V] by using the I2C serial interface.
err_t vcpmonitor6_get_bus_voltage(vcpmonitor6_t *ctx, float *voltage)
VCP Monitor 6 get the voltage function.
- vcpmonitor6_get_current This function reads the current measurement result in milliamperes [mA] by using the I2C serial interface.
err_t vcpmonitor6_get_current(vcpmonitor6_t *ctx, float *current)
VCP Monitor 6 get the current function.
- vcpmonitor6_get_power This function reads the power measurement result in watts [W] by using the I2C serial interface.
err_t vcpmonitor6_get_power(vcpmonitor6_t *ctx, float *power)
VCP Monitor 6 get the power function.
Application Init
The initialization of the I2C module and log UART. After driver initialization, the app sets the default configuration.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
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.
{
float app_buf = 0;
{
log_printf( &logger, " Voltage: %.2f [V]\r\n", app_buf );
Delay_ms ( 50 );
}
{
log_printf( &logger, " Current: %.2f [mA]\r\n", app_buf );
Delay_ms ( 50 );
}
{
log_printf( &logger, " Power: %.2f [W]\r\n", app_buf );
Delay_ms ( 50 );
}
{
log_printf( &logger, " Energy: %.2f [kJ]\r\n", app_buf );
Delay_ms ( 50 );
}
{
log_printf( &logger, " Charge: %.2f [C]\r\n", app_buf );
Delay_ms ( 50 );
}
{
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.