hwmonitor3  2.1.0.0
Main Page

HW Monitor 3 click

PRVIH_PAR_RECENICA_SA_PRODUCT_PAGE_DA_ISPRATE_CELINU

[click Product page](CLICK_PRODUCT_PAGE_LINK)


Click library

  • Author : Stefan Filipovic
  • Date : Jul 2024.
  • Type : I2C type

Software Support

We provide a library for the HW Monitor 3 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 HW Monitor 3 Click driver.

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of HW Monitor 3 click board by reading and displaying the voltage level from 6 analog input channels.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the click default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
hwmonitor3_cfg_t hwmonitor3_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
hwmonitor3_cfg_setup( &hwmonitor3_cfg );
HWMONITOR3_MAP_MIKROBUS( hwmonitor3_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == hwmonitor3_init( &hwmonitor3, &hwmonitor3_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( HWMONITOR3_ERROR == hwmonitor3_default_cfg ( &hwmonitor3 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}

Application Task

Reads the voltage level from all 6 analog input channels and displays the results on the USB UART once per second approximately.

void application_task ( void )
{
if ( HWMONITOR3_OK == hwmonitor3_read_voltage ( &hwmonitor3, &ch_mon ) )
{
log_printf ( &logger, " CH1: %.3f V\r\n", ch_mon.ch1_v );
log_printf ( &logger, " CH2: %.3f V\r\n", ch_mon.ch2_v );
log_printf ( &logger, " CH3: %.3f V\r\n", ch_mon.ch3_v );
log_printf ( &logger, " CH4: %.3f V\r\n", ch_mon.ch4_v );
log_printf ( &logger, " CH5: %.3f V\r\n", ch_mon.ch5_v );
log_printf ( &logger, " CH6: %.3f V\r\n\n", ch_mon.ch6_v );
}
Delay_ms ( 1000 );
}

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

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. UART terminal is available in all MikroElektronika compilers.


hwmonitor3_ch_mon_t
HW Monitor 3 Click channel voltage monitor object.
Definition: hwmonitor3.h:313
hwmonitor3_ch_mon_t::ch5_v
float ch5_v
Definition: hwmonitor3.h:318
hwmonitor3_enable_channel
err_t hwmonitor3_enable_channel(hwmonitor3_t *ctx, uint8_t ch_mask)
HW Monitor 3 enable channel function.
hwmonitor3_ch_mon_t::ch6_v
float ch6_v
Definition: hwmonitor3.h:319
HWMONITOR3_MAP_MIKROBUS
#define HWMONITOR3_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: hwmonitor3.h:297
hwmonitor3_ch_mon_t::ch2_v
float ch2_v
Definition: hwmonitor3.h:315
hwmonitor3_default_cfg
err_t hwmonitor3_default_cfg(hwmonitor3_t *ctx)
HW Monitor 3 default configuration function.
hwmonitor3_read_voltage
err_t hwmonitor3_read_voltage(hwmonitor3_t *ctx, hwmonitor3_ch_mon_t *ch_mon)
HW Monitor 3 read voltage function.
hwmonitor3_t
HW Monitor 3 Click context object.
Definition: hwmonitor3.h:328
hwmonitor3_ch_mon_t::ch4_v
float ch4_v
Definition: hwmonitor3.h:317
hwmonitor3_ch_mon_t::ch3_v
float ch3_v
Definition: hwmonitor3.h:316
application_task
void application_task(void)
Definition: main.c:65
hwmonitor3_cfg_setup
void hwmonitor3_cfg_setup(hwmonitor3_cfg_t *cfg)
HW Monitor 3 configuration object setup function.
hwmonitor3_cfg_t
HW Monitor 3 Click configuration object.
Definition: hwmonitor3.h:352
hwmonitor3_init
err_t hwmonitor3_init(hwmonitor3_t *ctx, hwmonitor3_cfg_t *cfg)
HW Monitor 3 initialization function.
application_init
void application_init(void)
Definition: main.c:29
HWMONITOR3_OK
@ HWMONITOR3_OK
Definition: hwmonitor3.h:372
HWMONITOR3_ERROR
@ HWMONITOR3_ERROR
Definition: hwmonitor3.h:373
hwmonitor3_set_scaling
err_t hwmonitor3_set_scaling(hwmonitor3_t *ctx, uint8_t scaling, uint8_t ch_mask)
HW Monitor 3 set scaling function.
hwmonitor3_ch_mon_t::ch1_v
float ch1_v
Definition: hwmonitor3.h:314