dcmotor23  2.1.0.0
Main Page

DC Motor 23 click

DC Motor 23 Click is a compact add-on board with a brushed DC motor driver. This board features the TB67H480FNG, a dual-channel, H-bridge, brushed DC motor driver from Toshiba Semiconductor. Fabricated with the BiCD process (DMOSFET is used for output power transistor), it covers a wide operating voltage range of 8.2V to 44V with a maximum output current capacity of 2A. It also offers many helpful features that support a robust and reliable operation, like the decay modes selection function, several protection features, and one anomaly detection indicator.

click Product page


Click library

  • Author : Nenad Filipovic
  • Date : Jan 2023.
  • Type : I2C type

Software Support

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

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of DC Motor 23 click boardâ„¢. by driving the motors in both direction every 3 seconds.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the click default configuration which sets the output torque to 100%.

void application_init ( void )
{
log_cfg_t log_cfg;
dcmotor23_cfg_t dcmotor23_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
dcmotor23_cfg_setup( &dcmotor23_cfg );
DCMOTOR23_MAP_MIKROBUS( dcmotor23_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == dcmotor23_init( &dcmotor23, &dcmotor23_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( DCMOTOR23_ERROR == dcmotor23_default_cfg ( &dcmotor23 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
log_printf ( &logger, "--------------------------\r\n" );
}

Application Task

This example demonstrates the use of the DC Motor 23 Click boardâ„¢. Drives the motors in the clockwise direction, after that decay the motors with a 3 seconds delay then switches to the counter-clockwise direction, and decay the motors with a 3 seconds delay. Results are being sent to the UART Terminal, where you can track their changes.

void application_task ( void )
{
{
log_printf ( &logger, " OUTA: Clockwise\r\n" );
}
{
log_printf ( &logger, " OUTB: Clockwise\r\n\n" );
}
Delay_ms ( 3000 );
{
log_printf ( &logger, " OUTA: Decay\r\n" );
}
{
log_printf ( &logger, " OUTB: Decay\r\n\n" );
}
Delay_ms ( 3000 );
{
log_printf ( &logger, " OUTA: Counter-Clockwise\r\n" );
}
{
log_printf ( &logger, " OUTB: Counter-Clockwise\r\n\n" );
}
Delay_ms ( 3000 );
{
log_printf ( &logger, " OUTA: Decay\r\n" );
}
{
log_printf ( &logger, " OUTB: Decay\r\n\n" );
}
log_printf ( &logger, "--------------------------\r\n" );
Delay_ms ( 3000 );
}

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

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.


DCMOTOR23_MAP_MIKROBUS
#define DCMOTOR23_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: dcmotor23.h:155
DCMOTOR23_ERROR
@ DCMOTOR23_ERROR
Definition: dcmotor23.h:218
application_task
void application_task(void)
Definition: main.c:71
dcmotor23_init
err_t dcmotor23_init(dcmotor23_t *ctx, dcmotor23_cfg_t *cfg)
DC Motor 23 initialization function.
dcmotor23_t
DC Motor 23 Click context object.
Definition: dcmotor23.h:172
dcmotor23_set_decay
err_t dcmotor23_set_decay(dcmotor23_t *ctx, uint8_t sel_motor)
DC Motor 23 set decay function.
dcmotor23_set_clockwise
err_t dcmotor23_set_clockwise(dcmotor23_t *ctx, uint8_t sel_motor)
DC Motor 23 set clockwise function.
application_init
void application_init(void)
Definition: main.c:34
dcmotor23_default_cfg
err_t dcmotor23_default_cfg(dcmotor23_t *ctx)
DC Motor 23 default configuration function.
dcmotor23_cfg_setup
void dcmotor23_cfg_setup(dcmotor23_cfg_t *cfg)
DC Motor 23 configuration object setup function.
DCMOTOR23_OK
@ DCMOTOR23_OK
Definition: dcmotor23.h:217
dcmotor23_cfg_t
DC Motor 23 Click configuration object.
Definition: dcmotor23.h:196
dcmotor23_set_counter_clockwise
err_t dcmotor23_set_counter_clockwise(dcmotor23_t *ctx, uint8_t sel_motor)
DC Motor 23 set counter clockwise function.
DCMOTOR23_SEL_OUT_A
#define DCMOTOR23_SEL_OUT_A
DC Motor 23 output setting.
Definition: dcmotor23.h:126
DCMOTOR23_SEL_OUT_B
#define DCMOTOR23_SEL_OUT_B
Definition: dcmotor23.h:127