hbridge9  2.0.0.0
Main Page

H-Bridge 9 click

<PRVIH_PAR_RECENICA_SA_PRODUCT_PAGE_DA_ISPRATE_CELINU>

[click Product page](<CLICK_PRODUCT_PAGE_LINK>)


Click library

  • Author : Stefan Filipovic
  • Date : Aug 2021.
  • Type : SPI type

Software Support

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

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of H-Bridge 9 click board.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the click default configuration which will set the OUT1 to LOW, OUT2 to HIGH polarity, and the runtime to 1000ms.

void application_init ( void )
{
log_cfg_t log_cfg;
hbridge9_cfg_t hbridge9_cfg;
// Logger initialization.
LOG_MAP_USB_UART( log_cfg );
log_cfg.level = LOG_LEVEL_DEBUG;
log_cfg.baud = 115200;
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
hbridge9_cfg_setup( &hbridge9_cfg );
HBRIDGE9_MAP_MIKROBUS( hbridge9_cfg, MIKROBUS_1 );
err_t init_flag = hbridge9_init( &hbridge9, &hbridge9_cfg );
if ( SPI_MASTER_ERROR == init_flag )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
init_flag = hbridge9_default_cfg ( &hbridge9 );
if ( HBRIDGE9_ERROR == init_flag )
{
log_error( &logger, " Default Config Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}

Application Task

Sends an actuation pulse every 5 seconds which will run the motor for a certain amount of time as set by default configuration.

void application_task ( void )
{
log_printf( &logger, " Actuation pulse has been sent. \r\n\n" );
Delay_ms( 5000 );
}

Note

The Vs should be supplied with 6 to 18V power supply. Make sure to use the motor that operate in the above voltage range.

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

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.


HBRIDGE9_MAP_MIKROBUS
#define HBRIDGE9_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: hbridge9.h:421
hbridge9_init
err_t hbridge9_init(hbridge9_t *ctx, hbridge9_cfg_t *cfg)
H-Bridge 9 initialization function.
HBRIDGE9_ERROR
@ HBRIDGE9_ERROR
Definition: hbridge9.h:483
application_task
void application_task(void)
Definition: main.c:69
hbridge9_read_register
err_t hbridge9_read_register(hbridge9_t *ctx, uint8_t reg, uint16_t *data_out)
H-Bridge 9 read register function.
hbridge9_t
H-Bridge 9 Click context object.
Definition: hbridge9.h:437
hbridge9_write_register
err_t hbridge9_write_register(hbridge9_t *ctx, uint8_t reg, uint16_t data_in)
H-Bridge 9 write register function.
hbridge9_cfg_setup
void hbridge9_cfg_setup(hbridge9_cfg_t *cfg)
H-Bridge 9 configuration object setup function.
application_init
void application_init(void)
Definition: main.c:33
hbridge9_cfg_t
H-Bridge 9 Click configuration object.
Definition: hbridge9.h:458
hbridge9_default_cfg
err_t hbridge9_default_cfg(hbridge9_t *ctx)
H-Bridge 9 default configuration function.
hbridge9_send_actuation_pulse
void hbridge9_send_actuation_pulse(hbridge9_t *ctx)
H-Bridge 9 send actuation pulse function.