dcmotor4  2.0.0.0
Main Page

DC Motor 4 click

DC MOTOR 4 click is capable of driving motors with a supply voltage from 4.5V to 36V. It carries the MAX14870 motor driver from Maxim Integrated.

click Product page


Click library

  • Author : MikroE Team
  • Date : Jan 2020.
  • Type : PWM type

Software Support

We provide a library for the DcMotor4 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

This library contains API for DcMotor4 Click driver.

Standard key functions :

Example key functions :

  • Generic sets PWM duty cycle.

    void dcmotor4_set_duty_cycle ( dcmotor4_t *ctx, pwm_data_t duty_cycle );

  • Stop PWM module.

    void dcmotor4_pwm_stop ( dcmotor4_t *ctx );

  • Start PWM module.

    void dcmotor4_pwm_start ( dcmotor4_t *ctx );

Examples Description

The click is designed to run on either 3.3V or 5V power supply.

The demo application is composed of two sections :

Application Init

Initialization driver enable's - GPIO,

set the direction-control of the motor forward movement, PWM initialization, set PWM duty cycle and PWM frequency, enable the motor, start PWM.

void application_init ( void )
{
log_cfg_t log_cfg;
// Logger initialization.
LOG_MAP_USB_UART( log_cfg );
log_cfg.level = LOG_LEVEL_DEBUG;
log_cfg.baud = 9600;
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
Delay_100ms();
// Click initialization.
DCMOTOR4_MAP_MIKROBUS( cfg, MIKROBUS_1 );
Delay_100ms();
dcmotor4_init( &dcmotor4, &cfg );
dcmotor4_pwm_start( &dcmotor4 );
}

Application Task

This is a example which demonstrates the use of DC Motor 4 Click board.

DC Motor 4 Click communicates with register via PWM.

void application_task ( void )
{
counter_clockwise( );
clockwise( );
}

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.DcMotor4

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.


application_init
void application_init()
Definition: main.c:70
dcmotor4_cfg_setup
void dcmotor4_cfg_setup(dcmotor4_cfg_t *cfg)
Config Object Initialization function.
dcmotor4_pwm_start
void dcmotor4_pwm_start(dcmotor4_t *ctx)
Start PWM module.
application_task
void application_task()
Definition: main.c:93
dcmotor4_init
DCMOTOR4_RETVAL dcmotor4_init(dcmotor4_t *ctx, dcmotor4_cfg_t *cfg)
Initialization function.
dcmotor4_cfg_t
Click configuration structure definition.
Definition: dcmotor4.h:111
DCMOTOR4_MAP_MIKROBUS
#define DCMOTOR4_MAP_MIKROBUS(cfg, mikrobus)
Definition: dcmotor4.h:52