Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
RSEDP_AM_MC1 Class Reference
RS-EDP Brushed Motor Control Application Module library. More...
#include <RSEDP_AM_MC1.h>
Public Member Functions | |
| RSEDP_AM_MC1 () | |
| Constructor. | |
| void | initialize (void) |
| Initialize a motor control module object. | |
| void | setPwmPin (PinName pwm) |
| Set the PWM pin. | |
| void | setMaxCurrentPin (PinName maxCurrent) |
| Set the maximum current in motor windings pin. | |
| void | setDirectionPin (PinName direction) |
| Set the motor direction pin. | |
| void | setBrakePin (PinName brake) |
| Set the motor brake pin. | |
| void | setVdclinkPin (PinName vdclink) |
| Set the VDCLINK pin. | |
| void | setVsensePin (PinName vsense) |
| Set the VSENSE pin. | |
| void | setVtachPin (PinName vtach) |
| Set the VTACH pin. | |
| void | setOpenLimitPin (PinName openLimit) |
| Set the open limit pin. | |
| void | setClosedLimitPin (PinName closedLimit) |
| Set the closed limit pin. | |
| void | setTachoPulsesPin (PinName tachoPulses) |
| Set the tachogenerator pulses pin. | |
| void | setEncoder0Pin (PinName encoder0) |
| Set the encoder input 0 pin. | |
| void | setEncoder1Pin (PinName encoder1) |
| Set the encoder input 1 pin. | |
| void | setRunStopPin (PinName runStop) |
| Set the motor run/stop pin. | |
| float | getPwmDuty (void) |
| Get the current PWM duty cycle. | |
| void | setPwmDuty (float duty) |
| Set the PWM duty cycle. | |
| float | getMaxCurrentDuty (void) |
| Get the maximum current in motor windings duty cycle. | |
| void | setMaxCurrentDuty (float duty) |
| Set the maximum current in the motor windings duty cycle. | |
| void | setDirection (int direction) |
| Set the direction of the motor. | |
| int | readDirection (void) |
| Read the direction of the motor. | |
| void | setBrake (int brakeSetting) |
| Set whether the brake is on or off. | |
| int | readVdclink (void) |
| Read the motor drive voltage. | |
| int | readVsense (void) |
| Read the motor current as voltage. | |
| int | readVtach (void) |
| Read tachogenerator output. | |
| int | readOpenLimit (void) |
| Read the open limit switch input. | |
| int | readClosedLimit (void) |
| Read the closed limit switch input. | |
| int | readTachoPulses (void) |
| Read pulse input from a tachogenerator. | |
| int | readEncoder0 (void) |
| Read channel 0 from a quadrature encoder/hall sensor. | |
| int | readEncoder1 (void) |
| Read channel 1 from a quadrature encoder/hall sensor. | |
| int | readRunStop (void) |
| Read motor run/stop input. | |
Detailed Description
RS-EDP Brushed Motor Control Application Module library.
Definition at line 62 of file RSEDP_AM_MC1.h.
Constructor & Destructor Documentation
| RSEDP_AM_MC1 | ( | ) |
Constructor.
Includes.
LICENSE
Copyright (c) 2010 ARM Limited
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
DESCRIPTION
AM-MC1 Brushed Motor application module for an RS-EDP base board.
There are a large number of options to choose from on the MC1 module. After creating an RSEDP_AM_MC1 object, select which pins you wish to use by making calls to "setXXXPin(pYY)" with appropriate pin you want to use.
The pins available and their associated jumpers which need to be set are detailed with the function declarations.
See the datasheet for more information about configuring the module for your application's needs.
Datasheet:
http://www.hitex.com/fileadmin/uk-files/EDP/Modules/MC1/MC1%20datasheet.pdf
Definition at line 48 of file RSEDP_AM_MC1.cpp.
Member Function Documentation
| float getMaxCurrentDuty | ( | void | ) |
Get the maximum current in motor windings duty cycle.
- Returns:
- A floating-point value representing the current duty-cycle being output on the pin, measured as a percentage. The returned value will lie between 0.0f (0%) and 1.0f (100%).
Definition at line 155 of file RSEDP_AM_MC1.cpp.
| float getPwmDuty | ( | void | ) |
Get the current PWM duty cycle.
- Returns:
- A floating-point value representing the current duty-cycle being output on the pin, measured as a percentage. The returned value will lie between 0.0f (0%) and 1.0f (100%).
Definition at line 143 of file RSEDP_AM_MC1.cpp.
| void initialize | ( | void | ) |
Initialize a motor control module object.
Set PWM frequency to 20kHz, brake on, direction "forward", speed 0.
Definition at line 52 of file RSEDP_AM_MC1.cpp.
| int readClosedLimit | ( | void | ) |
Read the closed limit switch input.
- Returns:
- The value of the closed limit switch input {0,1}.
Definition at line 213 of file RSEDP_AM_MC1.cpp.
| int readDirection | ( | void | ) |
Read the direction of the motor.
- Returns:
- The direction of the motor. 1 -> "Forward"/Clockwise 0 -> "Backward"/Counter-clockwise
Definition at line 172 of file RSEDP_AM_MC1.cpp.
| int readEncoder0 | ( | void | ) |
Read channel 0 from a quadrature encoder/hall sensor.
- Returns:
- The value on channel 0 of the sensor {0,1}.
Definition at line 225 of file RSEDP_AM_MC1.cpp.
| int readEncoder1 | ( | void | ) |
Read channel 1 from a quadrature encoder/hall sensor.
- Returns:
- value on channel 1 of the sensor {0,1}.
Definition at line 231 of file RSEDP_AM_MC1.cpp.
| int readOpenLimit | ( | void | ) |
Read the open limit switch input.
- Returns:
- The value of the open limit switch input {0,1}.
Definition at line 207 of file RSEDP_AM_MC1.cpp.
| int readRunStop | ( | void | ) |
Read motor run/stop input.
- Returns:
- value on the run/stop pin {0,1}.
Definition at line 237 of file RSEDP_AM_MC1.cpp.
| int readTachoPulses | ( | void | ) |
Read pulse input from a tachogenerator.
- Returns:
- The value of the tacho pulse input {0,1}.
Definition at line 219 of file RSEDP_AM_MC1.cpp.
| int readVdclink | ( | void | ) |
Read the motor drive voltage.
- Returns:
- The motor drive voltage in millivolts.
Definition at line 189 of file RSEDP_AM_MC1.cpp.
| int readVsense | ( | void | ) |
Read the motor current as voltage.
- Returns:
- The motor current as a voltage in millivolts.
Definition at line 195 of file RSEDP_AM_MC1.cpp.
| int readVtach | ( | void | ) |
Read tachogenerator output.
- Returns:
- Output from a tachogenerator in millivolts.
Definition at line 201 of file RSEDP_AM_MC1.cpp.
| void setBrake | ( | int | brakeSetting ) |
Set whether the brake is on or off.
- Parameters:
-
brakeSetting 1 -> Brake on. 0 -> Brake off.
Definition at line 178 of file RSEDP_AM_MC1.cpp.
| void setBrakePin | ( | PinName | brake ) |
Set the motor brake pin.
In order to use p19 as Motor Brake, it must be linked to GPIO0 on the mbed command module. The default track connection is to AN4.
- Parameters:
-
motorBrake p19 [JP209 2-3].
Definition at line 83 of file RSEDP_AM_MC1.cpp.
| void setClosedLimitPin | ( | PinName | closedLimit ) |
Set the closed limit pin.
In order to use p7 as Closed Limit Switch, it must be linked to EVG8_GPIO56 on the command module. The default track connection is to CNTRL_SPICLK.
- Parameters:
-
closedLimit p7 [JP309 2-3].
Definition at line 113 of file RSEDP_AM_MC1.cpp.
| void setDirection | ( | int | direction ) |
Set the direction of the motor.
Sets the motor direction to "Forward" (1, clockwise) or "Backward" (0, counter-clockwise).
- Parameters:
-
direction 1 -> "Forward"/Clockwise 0 -> "Backward"/Counter-clockwise
Definition at line 161 of file RSEDP_AM_MC1.cpp.
| void setDirectionPin | ( | PinName | direction ) |
Set the motor direction pin.
p24 is default for Motor Direction.
In order to use p29 as Motor Direction, it must be linked to EVG5_GPIO50 on the command module. This is the default track connection.
- Parameters:
-
motorDir p24 [JP206 1-2] XOR p29 [JP206 2-3]. Required: JP207 2-3.
Definition at line 77 of file RSEDP_AM_MC1.cpp.
| void setEncoder0Pin | ( | PinName | encoder0 ) |
Set the encoder input 0 pin.
In order to use p30 as Quadrature Encoder 0/Hall Sensor 0, it must be linked to EVG6_GPIO52 on the command module. This is the default track connection.
- Parameters:
-
encoder0 p30 [JP302 2-3]. Required: JP303 2-3.
Definition at line 125 of file RSEDP_AM_MC1.cpp.
| void setEncoder1Pin | ( | PinName | encoder1 ) |
Set the encoder input 1 pin.
In order to use p8 as Quadrature Encoder 1/Hall Sensor 1, it must be linked to EVG7_GPIO54 on the command module. The default track connection is to CS_LCD.
- Parameters:
-
encoder1 p8 [JP306 2-3].
Definition at line 131 of file RSEDP_AM_MC1.cpp.
| void setMaxCurrentDuty | ( | float | duty ) |
Set the maximum current in the motor windings duty cycle.
- Parameters:
-
duty A floating-point value representing the output duty-cycle, specified as a percentage. The value should lie between 0.0f (0%) and 1.0f (100%). Values outside this range will be saturated to 0.0f or 1.0f.
| void setMaxCurrentPin | ( | PinName | maxCurrent ) |
Set the maximum current in motor windings pin.
p21 is the default for setting the maximum current in the motor windings for a simple fixed-on time mode. Chopping frequency is ~25KHz. It is recommend to use PWM pin 23 instead of this.
In order to use p18 as setting the maximum current in the motor windings, it must be linked to CPU_DACO0_GPIO17 on the command module. The default track connection is to AN12.
In order to use p22 as setting the maximum current in the motor windings, it must be linked to CPU_DACO1_GPIO19. This is the default track connection.
- Parameters:
-
maxCurrent p18, p21 [JP202 1-2] XOR p22 [JP202 2-3].
Definition at line 71 of file RSEDP_AM_MC1.cpp.
| void setOpenLimitPin | ( | PinName | openLimit ) |
Set the open limit pin.
In order to use p11 as Open Limit Switch, it must be linked to EVM2_GPIO41_CAPADC on the command module. The default track connection is to GPIO12_MCICMD.
- Parameters:
-
openLimit p11 [JP314 1-2].
Definition at line 107 of file RSEDP_AM_MC1.cpp.
| void setPwmDuty | ( | float | duty ) |
Set the PWM duty cycle.
- Parameters:
-
duty A floating-point value representing the output duty-cycle, specified as a percentage. The value should lie between 0.0f (representing on 0%) and 1.0f (representing on 100%). Values outside this range will be saturated to 0.0f or 1.0f.
Definition at line 149 of file RSEDP_AM_MC1.cpp.
| void setPwmPin | ( | PinName | pwm ) |
Set the PWM pin.
p23 is default for PWM.
In order to use p27 as PWM, it must be linked to EVG4_GPIO48 on the command module. Default track connection is to ASC0_RX_TTL.
- Parameters:
-
pwm p23 [JP204 1-2] XOR p27 [JP204 2-3]. Required: JP203 2-3, JP205 1-2.
Definition at line 65 of file RSEDP_AM_MC1.cpp.
| void setRunStopPin | ( | PinName | runStop ) |
Set the motor run/stop pin.
In order to use p26 as Motor Run/Stop, it must be linked to EVG3_GPIO46 on the command module. The default track connection is to ASC1_TX_TTL.
- Parameters:
-
runStop p26 [JP311 1-2].
Definition at line 137 of file RSEDP_AM_MC1.cpp.
| void setTachoPulsesPin | ( | PinName | tachoPulses ) |
Set the tachogenerator pulses pin.
In order to use p30 as Tachogenerator Pulses, it must be linked to EVG6_GPIO52 on the command module. The is the default track connection.
- Parameters:
-
tachoPulses p30 [JP302 2-3]. Required: JP303 1-2.
Definition at line 119 of file RSEDP_AM_MC1.cpp.
| void setVdclinkPin | ( | PinName | vdclink ) |
Set the VDCLINK pin.
p17 is default for VDCLINK.
In order to use p18 as VDCLINK, it must be linked to AN12 on the command module. This is the default track connection.
- Parameters:
-
vdclink p17 [JP312 1-2] XOR p18 [JP312 2-3].
Definition at line 89 of file RSEDP_AM_MC1.cpp.
| void setVsensePin | ( | PinName | vsense ) |
Set the VSENSE pin.
p15 is default for VSENSE.
In order to use p16 as VSENSE, it must be linked to AN10 on the command module. This is the default track connection.
- Parameters:
-
vsense p15 [JP307 1-2] XOR p16 [JP307 2-3].
Definition at line 95 of file RSEDP_AM_MC1.cpp.
| void setVtachPin | ( | PinName | vtach ) |
Set the VTACH pin.
In order to use p19 as VTACH, it must be linked to AN4 on the command module. This is the default track connection.
- Parameters:
-
vtach p19 [JP304 1-2].
Definition at line 101 of file RSEDP_AM_MC1.cpp.
Generated on Fri Jul 15 2022 04:58:52 by
1.7.2