Jump to content

Component: DC Motor (): Difference between revisions

From Flowcode Help
No edit summary
No edit summary
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.


==Component Pack==
==Component Source Code==


MECHATRONICS
Please click here for the component source code: [https://www.flowcode.co.uk/wikicopy/componentsource/FC_Comp_Source_Motor_with_reverse.fcfx FC_Comp_Source_Motor_with_reverse.fcfx]


==Detailed description==
==Detailed description==




Line 32: Line 34:


==Examples==
==Examples==




Line 143: Line 147:
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Control Type
|-
|-
|-
|-
Line 159: Line 167:
|-
|-
| colspan="2" | Decides how the motor outputs are enabled. 
| colspan="2" | Decides how the motor outputs are enabled. 
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | PWM Settings
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
Line 172: Line 184:
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | Port
| width="90%" | Port
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Remap Pin
|-
|-
| colspan="2" |  
| colspan="2" |  
Line 205: Line 212:
| colspan="2" |  
| colspan="2" |  
|-
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" | Channel
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation Settings
|-
| colspan="2" | PWM Channel selector 
|-
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Polarity
|-
| colspan="2" | Selects the active output voltage.  Active high - Pins will be low when inactive and high when active. Active Low- Pins will be high when inactive and low when active. 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Timer
|-
| colspan="2" | Timer associated with PWM to drive the output.  Warning - All PWM channels linked to the same timer will share the same period and prescaler settings. 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Prescaler Divide
|-
| colspan="2" | Prescaler Divider value 
|-
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
| width="90%" | Period Register
|-
| colspan="2" | PWM Period Register value 
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | A Pin
|-
| colspan="2" | Output Pin A 
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | B Pin
|-
| colspan="2" | Output Pin B 
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | C Pin
|-
| colspan="2" | Output Pin C 
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | D Pin
|-
| colspan="2" | Output Pin D 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | A Remap Pin
|-
| colspan="2" | Remap Pin A - Specifies the pin used for the A output.  Only available on devices supporting remappable hardware pins. 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | B Remap Pin
|-
| colspan="2" | Remap Pin B - Specifies the pin used for the B output.  Only available on devices supporting remappable hardware pins. 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | C Remap Pin
|-
| colspan="2" | Remap Pin C - Specifies the pin used for the C output.  Only available on devices supporting remappable hardware pins. 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | D Remap Pin
|-
| colspan="2" | Remap Pin D - Specifies the pin used for the D output.  Only available on devices supporting remappable hardware pins. 
|-
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
| width="90%" | Frequency (KHz)
|-
| colspan="2" | Calculated PWM output frequency in KHz. 
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | Rising Bits
|-
| colspan="2" | Number of bits assigned to the rising edge dead band counter. Auto populated based on selected target chip. 
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | Falling Bits
|-
| colspan="2" | Number of bits assigned to the falling edge dead band counter. Auto populated based on selected target chip. 
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | Rising Count
|-
| colspan="2" | Number of cycles to wait after a falling edge and before a rising edge. 
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | Falling Count
|-
| colspan="2" | Number of cycles to wait after a rising edge and before a falling edge. 
|-
|-
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
Line 319: Line 240:
|-
|-
| colspan="2" | Which way the motor will rotate when the 'forwards' command is sent. 
| colspan="2" | Which way the motor will rotate when the 'forwards' command is sent. 
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Linkage
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
Line 324: Line 249:
|-
|-
| colspan="2" | An object or group to link the motor to - the object will move along with the motor. 
| colspan="2" | An object or group to link the motor to - the object will move along with the motor. 
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connections'''
|-
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | PinA
|-
| colspan="2" | First control pin - set 'pattern' properties below to set the pin's function. 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Forwards Pattern
|-
| colspan="2" | The state of pins A and B required to drive the motor in a forwards direction. 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Reverse Pattern
|-
| colspan="2" | States of pins A and B required to drive the motor in a reverse direction. 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Coast Pattern
|-
| colspan="2" | States of pins A and B required to stop the motor. 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Brake Pattern
|-
| colspan="2" | States of pins A and B required to stop the motor. 
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations'''
|-
|}
|}

Revision as of 17:49, 9 November 2022

Author Matrix Ltd.
Version 1.2
Category


DC Motor component

DC Motor that can be driven in one or both directions using digital output pins, PWM or HBRIDGE peripherals.

Component Source Code

Please click here for the component source code: FC_Comp_Source_Motor_with_reverse.fcfx

Detailed description

No detailed description exists yet for this component

Examples

Simple example showing how to drive the motor components and how to create sub assemblies attached to the motor output shafts in the simulation panels. Motors

Downloadable macro reference

Coast
Turn off power to the motor by setting the pins according to the 'Coast Pattern' property. 
- VOID Return


Break
Actively drives both ends of the motor by setting the pins according to the 'Brake Pattern' property. 
- VOID Return


Disable
Disable the motor output 
- VOID Return


Forwards
Set the motor turning in the forwards direction by setting the pins according to the 'Reverse Pattern' property. 
- UINT Duty
Sets the motor power for PWM or H-Bridge outputs 
- VOID Return


Enable
Enables the motor output 
- VOID Return


Reverse
Set the motor turning in the reverse direction by setting the pins according to the 'Reverse Pattern' property. 
- UINT Duty
Sets the motor power for PWM or H-Bridge outputs 
- VOID Return



Property reference

Properties
Control Type
Control Method
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 
Bridge Type
 
Enable Method
Decides how the motor outputs are enabled. 
PWM Settings
Channel
PWM Channel selector 
Alt Pin Enable
Alternative Pin Enable (if available on target device) 
Port
 
Period Register
PWM Period Register value 
Prescaler Divide
Prescaler Divider value 
PWM Timer
Timer associated with PWM to drive the output. Warning - All PWM channels linked to the same timer will share the same period and prescaler settings. 
Frequency (KHz)
 
Direction Pin
 
Simulation Settings
Speed
Speed of the motor when turned on. Positive speed -> Counter-clockwsie Negative speed -> Clockwise  
Acceleration
Speed change per second when the motor us powered. Set to zero for instantaneous speed changes.  
Deceleration
Speed change per second when the motor is coasting with no power. Set to zero for instantaneous speed changes. 
Show Actuator
When active, an actuator is shown on the motor spindle to make the animation easier to observe. 
Forwards Direction
Which way the motor will rotate when the 'forwards' command is sent. 
Linkage
Target Object
An object or group to link the motor to - the object will move along with the motor.