Difference between revisions of "Component: DC Motor (Mechatronics)"
From Flowcode Help
Jump to navigationJump to search(5 intermediate revisions by 2 users not shown) | |||
Line 15: | Line 15: | ||
DC Motor that can be driven in one or both directions using digital output pins, PWM or HBRIDGE peripherals. | DC Motor that can be driven in one or both directions using digital output pins, PWM or HBRIDGE peripherals. | ||
− | == | + | ==Version information== |
− | + | Library Version, Component Version, Date, Author, Info | |
− | + | 2, 1.2, 13-11-24, BR, Altered property tooltips to make them more meaningful | |
− | |||
==Detailed description== | ==Detailed description== | ||
Line 47: | Line 46: | ||
+ | Simple example showing how to drive the motor component by only using Enable and two port pins. | ||
+ | {{Fcfile|DC_Motor_pin_control.fcfx|DC Motor pin control}} | ||
+ | ==Macro reference== | ||
+ | ===Break=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Break''' | ||
+ | |- | ||
+ | | colspan="2" | Actively drives both ends of the motor by setting the pins according to the 'Brake Pattern' property. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
===Coast=== | ===Coast=== | ||
Line 89: | Line 80: | ||
− | === | + | ===Disable=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Disable''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Disable the motor output |
|- | |- | ||
|- | |- | ||
Line 103: | Line 94: | ||
− | === | + | ===Enable=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Enable''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Enables the motor output |
|- | |- | ||
|- | |- | ||
Line 136: | Line 127: | ||
− | === | + | ===GetSimAngle=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetSimAngle''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Gets the angle of the simulated motor shaft in degrees. |
|- | |- | ||
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
Line 167: | Line 158: | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Line 200: | Line 175: | ||
| width="90%" | Control Method | | width="90%" | Control Method | ||
|- | |- | ||
− | | colspan="2" | Controls how the motor is controlled. On/Off requires output pins PWM requires a hardware PWM channel H-Bridge requires a hardware H-Bridge channel | + | | colspan="2" | Controls how the motor is controlled. On/Off requires basic output pins, motor is full speed or stopped. PWM requires a hardware PWM channel and allows the motor speed to be controlled. H-Bridge requires a hardware H-Bridge channel and allows the motor speed to be controlled. |
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
| width="90%" | Bridge Type | | width="90%" | Bridge Type | ||
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Half Bridge - Motor can only be controlled in one direction. Full Bridge - Motor can be controlled in both directions. |
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
Line 260: | Line 235: | ||
| colspan="2" | Speed of the motor when turned on. Positive speed -> Counter-clockwsie Negative speed -> Clockwise | | colspan="2" | Speed of the motor when turned on. Positive speed -> Counter-clockwsie Negative speed -> Clockwise | ||
|} | |} | ||
+ | |||
+ | ==Component Source Code== | ||
+ | |||
+ | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_DCMotor_2d.fcfx FC_Comp_Source_DCMotor_2d.fcfx] | ||
+ | |||
+ | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_DCMotor_2d.fcfx FC_Comp_Source_DCMotor_2d.fcfx] |
Latest revision as of 11:42, 26 November 2024
Author | Matrix TSL |
Version | 1.2 |
Category | Mechatronics |
Contents
DC Motor component
DC Motor that can be driven in one or both directions using digital output pins, PWM or HBRIDGE peripherals.
Version information
Library Version, Component Version, Date, Author, Info 2, 1.2, 13-11-24, BR, Altered property tooltips to make them more meaningful
Detailed description
No detailed description exists yet for this component
Examples
Simple example showing how to drive the motor component by only using Enable and two port pins.
Macro reference
Break
![]() |
Break |
Actively drives both ends of the motor by setting the pins according to the 'Brake Pattern' property. | |
![]() |
Return |
Coast
![]() |
Coast |
Turn off power to the motor by setting the pins according to the 'Coast Pattern' property. | |
![]() |
Return |
Disable
![]() |
Disable |
Disable the motor output | |
![]() |
Return |
Enable
![]() |
Enable |
Enables the motor output | |
![]() |
Return |
Forwards
![]() |
Forwards |
Set the motor turning in the forwards direction by setting the pins according to the 'Forwards Pattern' property. | |
![]() |
Duty |
Sets the motor power for PWM or H-Bridge outputs | |
![]() |
Return |
GetSimAngle
![]() |
GetSimAngle |
Gets the angle of the simulated motor shaft in degrees. | |
![]() |
Return |
Reverse
![]() |
Reverse |
Set the motor turning in the reverse direction by setting the pins according to the 'Reverse Pattern' property. | |
![]() |
Duty |
Sets the motor power for PWM or H-Bridge outputs | |
![]() |
Return |
Property reference
Component Source Code
Please click here to download the component source project: FC_Comp_Source_DCMotor_2d.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_DCMotor_2d.fcfx