Component: Servo Motor Controller (Mechatronics)

From Flowcode Help
Jump to navigationJump to search
Author Matrix Ltd
Version 2.1
Category Mechatronics


Servo Motor Controller component

Can control up to eight standard PWM driven servo's. Supports 8-bit and 16-bit movement resolutions. 'Servo Object' properties allow you to connect the controller to on-screen simulations using the "Servo Motor" component and its derivatives.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_Servo_Controller.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_Servo_Controller.fcfx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples








Macro reference

AutoMoveToPosition

Fc9-comp-macro.png AutoMoveToPosition
Automatically moves towards the new position at a fixed rate determined by the AutoMoveSpeed. 
Fc9-u8-icon.png - BYTE Channel
The channel to assign the new position. Range: 0-7 
Fc9-u8-icon.png - BYTE Position
Position to automatically move to. Range: 0-255 
Fc9-void-icon.png - VOID Return


AutoMoveToPositionInt

Fc9-comp-macro.png AutoMoveToPositionInt
Automatically moves towards the new 16-bit position at a fixed rate determined by the AutoMoveSpeed. 
Fc9-u8-icon.png - BYTE Channel
The channel to assign the new position. Range: 0-7 
Fc9-u16-icon.png - UINT Position
Position to automatically move to. Range: 0-65535 
Fc9-void-icon.png - VOID Return


DisableServo

Fc9-comp-macro.png DisableServo
Disables a servo channel effectivly disabling the motor. 
Fc9-u8-icon.png - BYTE Channel
The channel to set the position for. First channel is zero. 
Fc9-void-icon.png - VOID Return


EnableServo

Fc9-comp-macro.png EnableServo
Enables a servo channel effectivly setting the position of the motor to the value in the local position variable. 
Fc9-u8-icon.png - BYTE Channel
The channel to set the position for. First channel is zero. 
Fc9-void-icon.png - VOID Return


Initialise

Fc9-comp-macro.png Initialise
Sets up the servo motor interrupts 
Fc9-void-icon.png - VOID Return


IsAutoMoving

Fc9-comp-macro.png IsAutoMoving
Is the AutoMoveToPosition movement complete. Returns 1 if the servos are still moving. Returns 0 if all servo movement is complete. 
Fc9-u8-icon.png - BYTE Return


IsServoAutoMoving

Fc9-comp-macro.png IsServoAutoMoving
Is the AutoMoveToPosition movement complete for a specific servo output. Returns 1 if the servo is still moving. Returns 0 if the servo movement is complete. 
Fc9-u8-icon.png - BYTE Channel
Servo Motor Output Range: 0-7 
Fc9-u8-icon.png - BYTE Return


MoveToPosition

Fc9-comp-macro.png MoveToPosition
Moves a single step towards the new position, the rate of movement is determined by how often the move to macro is called. Returns 1 if the position has been reached. 
Fc9-u8-icon.png - BYTE Channel
The channel to assign the new position. Range: 0-7 
Fc9-u8-icon.png - BYTE Position
Target position to move towards. Range: 0-255 
Fc9-u8-icon.png - BYTE Return


MoveToPositionInt

Fc9-comp-macro.png MoveToPositionInt
Moves a single step towards the new position, the rate of movement is determined by how often the move to macro is called. Returns 1 if the position has been reached. 
Fc9-u8-icon.png - BYTE Channel
The channel to assign the new position. Range: 0-7 
Fc9-u16-icon.png - UINT Position
Target position to move towards. Range: 0-65535 
Fc9-u8-icon.png - BYTE Return


SetAutoMoveSpeed

Fc9-comp-macro.png SetAutoMoveSpeed
Sets the speed of the auto move to position macro. Default speed is shown in the Servo_Period_Multiplier property. 
Fc9-u8-icon.png - BYTE Speed
1=Slowest (Default), 2= Double, 3=Triple, 4=Quadruple 
Fc9-void-icon.png - VOID Return


SetAutoMoveSpeedInt

Fc9-comp-macro.png SetAutoMoveSpeedInt
Sets the speed of the auto move to position macro. Default speed is shown in the Servo_Period_Multiplier property. 
Fc9-u16-icon.png - UINT Speed
1=Slowest (Default), 2= Double, 3=Triple, 4=Quadruple 
Fc9-void-icon.png - VOID Return


SetPosition

Fc9-comp-macro.png SetPosition
Moves directly to the specified position with no interpolation.  
Fc9-u8-icon.png - BYTE Channel
The channel to assign the new position. Range: 0-7 
Fc9-u8-icon.png - BYTE Position
Position to jump to. Range: 0-255 
Fc9-void-icon.png - VOID Return


SetPositionInt

Fc9-comp-macro.png SetPositionInt
Moves directly to the specified position with no interpolation. Uses a 16-bit position parameter to add extra precision. 
Fc9-u8-icon.png - BYTE Channel
The channel to assign the new position. Range: 0-7 
Fc9-u16-icon.png - UINT Position
Position to jump to. Range: 0-65535 
Fc9-void-icon.png - VOID Return


SetTrim

Fc9-comp-macro.png SetTrim
Allows the level of trim for each servo channel to be adjusted progmatically. 
Fc9-u8-icon.png - BYTE Channel
The channel to set the position for. First channel is zero. 
Fc9-u8-icon.png - BYTE Trim
Legacy: 0=0us, 1=+25us, 2=+50us, 3=+75us, 4=+100us, 5=-25us, 6=-50us, 7=-75us, 8=-100us or Smooth: 0-200 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-type-16-icon.png Channels (1 - 8)
Set the number of servo's that you need to control. Value from 1 to 8. 
Fc9-conn-icon.png Connections
Fc9-type-5-icon.png Channel 0
Pin on which to output PWM for the servo motor. 
Fc9-type-5-icon.png Channel 1
Pin on which to output PWM for the servo motor. 
Fc9-type-5-icon.png Channel 2
Pin on which to output PWM for the servo motor. 
Fc9-type-5-icon.png Channel 3
Pin on which to output PWM for the servo motor. 
Fc9-type-5-icon.png Channel 4
Pin on which to output PWM for the servo motor. 
Fc9-type-5-icon.png Channel 5
Pin on which to output PWM for the servo motor. 
Fc9-type-5-icon.png Channel 6
Pin on which to output PWM for the servo motor. 
Fc9-type-5-icon.png Channel 7
Pin on which to output PWM for the servo motor. 
Fc9-conn-icon.png Resources
Fc9-type-10-icon.png Peripherals
Lists the internal peripherals of the MCU used by the component. When the servo motor is initialised you will not be able to use the listed peripherals for other functionality. 
Fc9-conn-icon.png Trim
Fc9-type-16-icon.png Trim Mode
 
Fc9-type-16-icon.png Trim 0
Trim the pulse width for this channel. Use this to trim the positioning of two servos so that similar input values will produce the same degree of movement. 
Fc9-type-16-icon.png Trim 1
Trim the pulse width for this channel. Use this to trim the positioning of two servos so that similar input values will produce the same degree of movement. 
Fc9-type-16-icon.png Trim 2
Trim the pulse width for this channel. Use this to trim the positioning of two servos so that similar input values will produce the same degree of movement. 
Fc9-type-16-icon.png Trim 3
Trim the pulse width for this channel. Use this to trim the positioning of two servos so that similar input values will produce the same degree of movement. 
Fc9-type-16-icon.png Trim 4
Trim the pulse width for this channel. Use this to trim the positioning of two servos so that similar input values will produce the same degree of movement. 
Fc9-type-16-icon.png Trim 5
Trim the pulse width for this channel. Use this to trim the positioning of two servos so that similar input values will produce the same degree of movement. 
Fc9-type-16-icon.png Trim 6
Trim the pulse width for this channel. Use this to trim the positioning of two servos so that similar input values will produce the same degree of movement. 
Fc9-type-16-icon.png Trim 7
Trim the pulse width for this channel. Use this to trim the positioning of two servos so that similar input values will produce the same degree of movement. 
Fc9-conn-icon.png Pulse Width
Fc9-type-21-icon.png Minimum (us)
Shortest pulse width that will be used. 
Fc9-type-21-icon.png Maximum (us)
Longest pulse width used for the PWM signals. 
Fc9-type-21-icon.png Period Multiplier
Number of instructions for 1 / 256th of the positional accuracy. This sets the default movement speed to maintain legacy move speeds. Also sets the multiplication factor to convert from a byte 0-255 to a clocked position value. 
Fc9-conn-icon.png Simulation
Fc9-type-17-icon.png Servo Object 0
Drag a servo motor component onto the System Panel, and then select it here, to create an on screen simulation of the way that your flowchart moves the servo's. Servo motors should be based on the 'Servo Motor Base' component, or use a custom component set to responf to 'User.Notify' events (ID = n/a, Data = Position (0-127)). 
Fc9-type-17-icon.png Servo Object 1
Drag a servo motor component onto the System Panel, and then select it here, to create an on screen simulation of the way that your flowchart moves the servo's. Servo motors should be based on the 'Servo Motor Base' component, or use a custom component set to responf to 'User.Notify' events (ID = n/a, Data = Position (0-127)). 
Fc9-type-17-icon.png Servo Object 2
Drag a servo motor component onto the System Panel, and then select it here, to create an on screen simulation of the way that your flowchart moves the servo's. Servo motors should be based on the 'Servo Motor Base' component, or use a custom component set to responf to 'User.Notify' events (ID = n/a, Data = Position (0-127)). 
Fc9-type-17-icon.png Servo Object 3
Drag a servo motor component onto the System Panel, and then select it here, to create an on screen simulation of the way that your flowchart moves the servo's. Servo motors should be based on the 'Servo Motor Base' component, or use a custom component set to responf to 'User.Notify' events (ID = n/a, Data = Position (0-127)). 
Fc9-type-17-icon.png Servo Object 4
Drag a servo motor component onto the System Panel, and then select it here, to create an on screen simulation of the way that your flowchart moves the servo's. Servo motors should be based on the 'Servo Motor Base' component, or use a custom component set to responf to 'User.Notify' events (ID = n/a, Data = Position (0-127)). 
Fc9-type-17-icon.png Servo Object 5
Drag a servo motor component onto the System Panel, and then select it here, to create an on screen simulation of the way that your flowchart moves the servo's. Servo motors should be based on the 'Servo Motor Base' component, or use a custom component set to responf to 'User.Notify' events (ID = n/a, Data = Position (0-127)). 
Fc9-type-17-icon.png Servo Object 6
Drag a servo motor component onto the System Panel, and then select it here, to create an on screen simulation of the way that your flowchart moves the servo's. Servo motors should be based on the 'Servo Motor Base' component, or use a custom component set to responf to 'User.Notify' events (ID = n/a, Data = Position (0-127)). 
Fc9-type-17-icon.png Servo Object 7
Drag a servo motor component onto the System Panel, and then select it here, to create an on screen simulation of the way that your flowchart moves the servo's. Servo motors should be based on the 'Servo Motor Base' component, or use a custom component set to responf to 'User.Notify' events (ID = n/a, Data = Position (0-127)).