Brushless 7 click
Brushless 7 Click is, as its name said, a motor driver based expansion board for controlling BLCD motors with any microcontroller.
click Product page
Click library
- Author : MikroE Team
- Date : Jul 2020.
- Type : I2C type
Software Support
We provide a library for the Brushless7 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 Brushless7 Click driver.
Standard key functions :
- Config Object Initialization function.
void brushless7_cfg_setup ( brushless7_cfg_t *cfg );
- Initialization function.
BRUSHLESS7_RETVAL brushless7_init ( brushless7_t *ctx, brushless7_cfg_t *cfg );
- Click Default Configuration function.
void brushless7_default_cfg ( brushless7_t *ctx );
Example key functions :
- Function for changeing duty of device
uint8_t brushless7_change_duty ( brushless7_t *ctx, float duty_ptc );
- Function for setting max rpm parameter of device
uint8_t brushless7_max_speed_rpm ( brushless7_t *ctx, uint8_t max_speed_rpm );
- Function for setting type of device control
uint8_t brushless7_control_mode_set ( brushless7_t *ctx, uint8_t ctrl_type );
Examples Description
This example demonstrates the use of Brushless 7 Click board.
The demo application is composed of two sections :
Application Init
Sets the default configuration and then configures the click board for the selected mode.
{
log_cfg_t log_cfg;
uint8_t error_flag = 0;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
Delay_ms ( 100 );
Delay_ms ( 100 );
{
log_printf( &logger, " ----- DUTY CONTROL ----- \r\n" );
}
{
log_printf( &logger, " ----- RPM CONTROL ----- \r\n" );
}
{
log_printf( &logger, " ----- ERROR ----- \r\n" );
for( ; ; );
}
}
#define BRUSHLESS7_CTRL_TYPE_RPM
Definition brushless7.h:158
#define BRUSHLESS7_CTRL_TYPE_DUTY
Definition brushless7.h:159
#define BRUSHLESS7_DEV_ERROR
Definition brushless7.h:140
#define BRUSHLESS7_MAP_MIKROBUS(cfg, mikrobus)
Definition brushless7.h:67
#define BRUSHLESS7_MAX_SPEED_4096
Definition brushless7.h:148
void brushless7_cfg_setup(brushless7_cfg_t *cfg)
Config Object Initialization function.
uint8_t brushless7_start_duty(brushless7_t *ctx, float duty_ptc)
Function for setting start duty of device.
BRUSHLESS7_RETVAL brushless7_init(brushless7_t *ctx, brushless7_cfg_t *cfg)
Initialization function.
uint8_t brushless7_max_speed_rpm(brushless7_t *ctx, uint8_t max_speed_rpm)
Function for setting max rpm parameter of device.
uint8_t brushless7_max_duty(brushless7_t *ctx, float duty_ptc)
Function for setting max duty of device.
uint8_t brushless7_stop_duty(brushless7_t *ctx, float duty_ptc)
Function for setting stop duty of device.
void brushless7_default_cfg(brushless7_t *ctx)
Click Default Configuration function.
void application_init(void)
Definition main.c:37
uint8_t demo_type_data
Definition main.c:33
Click configuration structure definition.
Definition brushless7.h:282
Application Task
Increases and decreases the speed of the motor rotation by setting the duty cycle or rpm values depending on which mode is previously selected. It also switches the direction of rotation at the beginning of each cycle. All data is being logged on the USB UART where you can track their changes.
{
Delay_ms ( 1000 );
Delay_ms ( 1000 );
{
log_printf( &logger, " The motor is accelerating...\r\n" );
log_printf( &logger, "------------------------------\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, " The motor is slowing down...\r\n" );
log_printf( &logger, "------------------------------\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
{
log_printf( &logger, " The motor is accelerating...\r\n" );
log_printf( &logger, "------------------------------\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, " The motor is slowing down...\r\n" );
log_printf( &logger, "------------------------------\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
}
#define BRUSHLESS7_CTRL_TYPE_STOP
Definition brushless7.h:160
uint8_t brushless7_start_rpm(brushless7_t *ctx, uint16_t rpm_val)
Function for setting start rpm parameter of device.
void brushless7_toggle_dir_pin_state(brushless7_t *ctx)
Generic function for toggling DIR pin state.
uint8_t brushless7_control_mode_set(brushless7_t *ctx, uint8_t ctrl_type)
Function for setting type of device control.
uint8_t brushless7_change_duty(brushless7_t *ctx, float duty_ptc)
Function for changeing duty of device.
void application_task(void)
Definition main.c:88
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.Brushless7
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.