Library for MAX14871 Shield, MAXREFDES89#

Dependencies:   MAX5387 MAX7300

Dependents:   MAXREFDES89_MAX14871_Shield_Demo MAXREFDES89_Test_Program Line_Following_Bot Line_Following_Bot_Pololu

Embed: (wiki syntax)

« Back to documentation index

Max14871_Shield Class Reference

Max14871_Shield Class Reference

MAX14871 Full-Bridge DC Motor Driver MBED Shield Library. More...

#include <max14871_shield.h>

Public Types

enum  max14871_motor_driver_t
 

Motor driver channels.

More...
enum  max14871_operating_mode_t
 

Operating modes.

More...
enum  max14871_current_regulation_mode_t
 

Current regulation modes.

More...

Public Member Functions

 Max14871_Shield (I2C *i2c_bus, bool default_config=true)
 Constructor for Max14871_Shield Class.
 Max14871_Shield (PinName sda, PinName scl, bool default_config=true)
 Constructor for Max14871_Shield Class.
 ~Max14871_Shield ()
 Default destructor for Max14871_Shield Class.
int16_t set_operating_mode (max14871_motor_driver_t md, max14871_operating_mode_t mode)
 Set the operating mode of the motor driver.
int16_t set_current_regulation_mode (max14871_motor_driver_t md, max14871_current_regulation_mode_t mode, float vref=1.0)
int16_t set_pwm_channel (max14871_motor_driver_t md, PinName ch)
 Sets pwm channel for given motor driver.
int16_t set_pwm_period (max14871_motor_driver_t md, float period)
 Sets period of pwm signal for selected motor driver.
int16_t set_pwm_duty_cycle (max14871_motor_driver_t md, float duty_cycle)
 Sets duty cycle of pwm signal for selected motor driver.
max14871_operating_mode_t get_operating_mode (max14871_motor_driver_t md)
 Get operating mode of selected motor driver.
max14871_current_regulation_mode_t get_current_regulation_mode (max14871_motor_driver_t md)
 Get current regulation mode of selected motor driver.
float get_pwm_duty_cycle (max14871_motor_driver_t md)
 Get duty cycle of selected motor driver.
float get_pwm_period (max14871_motor_driver_t md)
 Get pwm period of selected motor driver.
float get_external_voltage_ref (max14871_motor_driver_t md)
 Get external voltage reference of selected motor driver.

Detailed Description

MAX14871 Full-Bridge DC Motor Driver MBED Shield Library.

The MAXREFDES89# provides an ideal interface for anyone developing with brushed DC motors. The design is an mbed®-compatible, Arduino® form factor shield for the rapid development of brushed DC motor applications. The shield contains four MAX14871 full-bridge DC motor drivers for driving up to 4 motors. A MAX17501 DC-DC converter allows the system to operate from a single 7 to 36VDC power supply. Four MAX4704 4:1 multiplexers permit setting the current regulation mode of the MAX14871, while two MAX5387 digital potentiometers provide the ability to set the motor current limit. A MAX7300 GPIO expander supports interfacing each motor driver circuit to the mbed-enabled microcontroller platform.

Definition at line 62 of file max14871_shield.h.


Member Enumeration Documentation

Current regulation modes.

Three different current regulation modes offered with either an internal or external reference for setting the regulation limit. This is not the fault current which is fixed, see datasheet.

Definition at line 98 of file max14871_shield.h.

Motor driver channels.

Simple enumeration of channels available on the shield

Definition at line 70 of file max14871_shield.h.

Operating modes.

Motor operating modes offered on each channel

Definition at line 83 of file max14871_shield.h.


Constructor & Destructor Documentation

Max14871_Shield ( I2C *  i2c_bus,
bool  default_config = true 
)

Constructor for Max14871_Shield Class.

Allows user to use existing I2C object

On Entry:

Parameters:
[in]i2c_bus- pointer to existing I2C object
[in]default_config- true if board uses default pwm channels and I2C addressing

On Exit:

Returns:
None

Definition at line 54 of file max14871_shield.cpp.

Max14871_Shield ( PinName  sda,
PinName  scl,
bool  default_config = true 
)

Constructor for Max14871_Shield Class.

Allows user to create a new I2C object if not already using one

On Entry:

Parameters:
[in]sda- sda pin of I2C bus
[in]scl- scl pin of I2C bus
[in]default_config- true if board uses default pwm channels and I2C addressing

On Exit:

Returns:
None

Definition at line 86 of file max14871_shield.cpp.

Default destructor for Max14871_Shield Class.

Destroys I2C object if owner

On Entry:

On Exit:

Returns:
None

Definition at line 119 of file max14871_shield.cpp.


Member Function Documentation

Get current regulation mode of selected motor driver.

On Entry:

Parameters:
[in]md- 1 of 4 motor drivers on the shield

On Exit:

Returns:
Current regulation mode of selected motor driver

Definition at line 569 of file max14871_shield.cpp.

float get_external_voltage_ref ( max14871_motor_driver_t  md )

Get external voltage reference of selected motor driver.

On Entry:

Parameters:
[in]md- 1 of 4 motor drivers on the shield

On Exit:

Returns:
External voltage reference of selected motor driver

Definition at line 590 of file max14871_shield.cpp.

Get operating mode of selected motor driver.

On Entry:

Parameters:
[in]md- 1 of 4 motor drivers on the shield

On Exit:

Returns:
Operating mode of selected motor driver

Definition at line 562 of file max14871_shield.cpp.

float get_pwm_duty_cycle ( max14871_motor_driver_t  md )

Get duty cycle of selected motor driver.

On Entry:

Parameters:
[in]md- 1 of 4 motor drivers on the shield

On Exit:

Returns:
Duty cycle of selected motor driver

Definition at line 576 of file max14871_shield.cpp.

float get_pwm_period ( max14871_motor_driver_t  md )

Get pwm period of selected motor driver.

On Entry:

Parameters:
[in]md- 1 of 4 motor drivers on the shield

On Exit:

Returns:
pwm period of selected motor driver

Definition at line 583 of file max14871_shield.cpp.

int16_t set_current_regulation_mode ( max14871_motor_driver_t  md,
max14871_current_regulation_mode_t  mode,
float  vref = 1.0 
)

On Entry:

Parameters:
[in]md- 1 of 4 motor drivers on the shield
[in]mode- 1 of 6 current regulation modes of the motor driver
[in]vref- sets maximum motor current, Max of 2.0V

On Exit:

Returns:
0 on success, non-0 on failure

Definition at line 232 of file max14871_shield.cpp.

int16_t set_operating_mode ( max14871_motor_driver_t  md,
max14871_operating_mode_t  mode 
)

Set the operating mode of the motor driver.

Configures the /EN and DIR pins of the motor driver via the MAX7300 GPIO Expander

On Entry:

Parameters:
[in]md- 1 of 4 motor drivers on the shield
[in]mode- 1 of 4 operating modes of the motor driver

On Exit:

Returns:
0 on success, non-0 on failure

Definition at line 137 of file max14871_shield.cpp.

int16_t set_pwm_channel ( max14871_motor_driver_t  md,
PinName  ch 
)

Sets pwm channel for given motor driver.

Must use default, or alternate channel for specific motor driver. Function allows for mix of default and alternates for each motor driver vs all default or all alternate.

On Entry:

Parameters:
[in]md- 1 of 4 motor drivers on the shield
[in]ch- PWM channel using Arduino naming convention

On Exit:

Returns:
0 on success, non-0 on failure

Definition at line 375 of file max14871_shield.cpp.

int16_t set_pwm_duty_cycle ( max14871_motor_driver_t  md,
float  duty_cycle 
)

Sets duty cycle of pwm signal for selected motor driver.

duty cycle must be in micro-seconds

On Entry:

Parameters:
[in]md- 1 of 4 motor drivers on the shield
[in]duty_cycle- duty cycle of the pwm signal specified as a percentage

On Exit:

Returns:
0 on success, non-0 on failure

Definition at line 526 of file max14871_shield.cpp.

int16_t set_pwm_period ( max14871_motor_driver_t  md,
float  period 
)

Sets period of pwm signal for selected motor driver.

period must be in micro-seconds

On Entry:

Parameters:
[in]md- 1 of 4 motor drivers on the shield
[in]period- PWM period specified in seconds

On Exit:

Returns:
0 on success, non-0 on failure

Definition at line 483 of file max14871_shield.cpp.