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.
Detailed description
No detailed description exists yet for this component
Examples
Example showing how to control three servos using AutoMoveToPosion, MoveTopposition & SetPosition component macros.
Controlling Servos Example.fcfx
Example using BL0162 Servo controller for BL0055 Arduino Shield
Samples the Port D8-D13 (portB) switches and moves the servo motors based on the input states.
D8 increments motor 0, D9 decrements motor on channel 0.
D10 increments motor 1, D11 decrements motor on channel 1.
D12 increments motor 3, D13 decrements motor on channel 2.
Connections:
Servo Board Port D0-D2.
Switch Board Port D8 - D13
LCD A0 to A5 (PortC)
Macro reference
AutoMoveToAngle
|
AutoMoveToAngle
|
Automatically moves towards the new angle at a fixed rate determined by the AutoMoveSpeed. AutoMove not currently supported by ESP32.
|
- BYTE
|
Channel
|
The channel to assign the new position. Range: 0-7
|
- BYTE
|
Angle
|
Angle in degrees, Range 0 to calibration angle
|
- VOID
|
Return
|
AutoMoveToPosition
|
AutoMoveToPosition
|
Automatically moves towards the new position at a fixed rate determined by the AutoMoveSpeed. AutoMove not currently supported by ESP32.
|
- BYTE
|
Channel
|
The channel to assign the new position. Range: 0-7
|
- BYTE
|
Position
|
Position to automatically move to. Range: 0-255
|
- VOID
|
Return
|
AutoMoveToPositionInt
|
AutoMoveToPositionInt
|
Automatically moves towards the new 16-bit position at a fixed rate determined by the AutoMoveSpeed. AutoMove not currently supported by ESP32.
|
- BYTE
|
Channel
|
The channel to assign the new position. Range: 0-7
|
- UINT
|
Position
|
Position to automatically move to. Range: 0-65535
|
- VOID
|
Return
|
DisableServo
|
DisableServo
|
Disables a servo channel effectivly disabling the motor.
|
- BYTE
|
Channel
|
The channel to set the position for. First channel is zero.
|
- VOID
|
Return
|
EnableServo
|
EnableServo
|
Enables a servo channel effectivly setting the position of the motor to the value in the local position variable.
|
- BYTE
|
Channel
|
The channel to set the position for. First channel is zero.
|
- VOID
|
Return
|
Initialise
|
Initialise
|
Sets up the servo motor interrupts
|
- VOID
|
Return
|
IsAutoMoving
|
IsAutoMoving
|
Is the AutoMoveToPosition movement complete. Returns 1 if the servos are still moving. Returns 0 if all servo movement is complete.
|
- BYTE
|
Return
|
IsServoAutoMoving
|
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.
|
- BYTE
|
Channel
|
Servo Motor Output Range: 0-7
|
- BYTE
|
Return
|
MoveToAngle
|
MoveToAngle
|
Moves a single step towards the new angle, the rate of movement is determined by how often the move to macro is called. Returns 1 if the position has been reached.
|
- BYTE
|
Channel
|
The channel to assign the new position. Range: 0-7
|
- BYTE
|
Angle
|
Angle in degrees, Range 0 to calibration angle
|
- BOOL
|
Return
|
MoveToPosition
|
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.
|
- BYTE
|
Channel
|
The channel to assign the new position. Range: 0-7
|
- BYTE
|
Position
|
Target position to move towards. Range: 0-255
|
- BYTE
|
Return
|
MoveToPositionInt
|
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.
|
- BYTE
|
Channel
|
The channel to assign the new position. Range: 0-7
|
- UINT
|
Position
|
Target position to move towards. Range: 0-65535
|
- BYTE
|
Return
|
SetAngle
|
SetAngle
|
Moves the motor straight to the specified angle. Uses the angle property to calculate the correct amount to move.
|
- BYTE
|
Channel
|
The channel to assign the new position. Range: 0-7
|
- BYTE
|
Angle
|
Angle in degrees, Range 0 to calibration angle
|
- VOID
|
Return
|
SetAutoMoveSpeed
|
SetAutoMoveSpeed
|
Sets the speed of the auto move to position macro. Default speed is shown in the Servo_Period_Multiplier property.
|
- BYTE
|
Speed
|
1=Slowest (Default), 2= Double, 3=Triple, 4=Quadruple
|
- VOID
|
Return
|
SetAutoMoveSpeedInt
|
SetAutoMoveSpeedInt
|
Sets the speed of the auto move to position macro. Default speed is shown in the Servo_Period_Multiplier property.
|
- UINT
|
Speed
|
1=Slowest (Default), 2= Double, 3=Triple, 4=Quadruple
|
- VOID
|
Return
|
SetPosition
|
SetPosition
|
Moves directly to the specified position with no interpolation.
|
- BYTE
|
Channel
|
The channel to assign the new position. Range: 0-7
|
- BYTE
|
Position
|
Position to jump to. Range: 0-255
|
- VOID
|
Return
|
SetPositionInt
|
SetPositionInt
|
Moves directly to the specified position with no interpolation. Uses a 16-bit position parameter to add extra precision.
|
- BYTE
|
Channel
|
The channel to assign the new position. Range: 0-7
|
- UINT
|
Position
|
Position to jump to. Range: 0-65535
|
- VOID
|
Return
|
SetTrim
|
SetTrim
|
Allows the level of trim for each servo channel to be adjusted progmatically.
|
- BYTE
|
Channel
|
The channel to set the position for. First channel is zero.
|
- 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
|
- VOID
|
Return
|
Property reference
|
Properties
|
|
Channels (1 - 8)
|
Set the number of servo's that you need to control. Value from 1 to 8.
|
|
Resources
|
|
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.
|
|
Pulse Width
|
|
Minimum (us)
|
Shortest pulse width that will be used.
|
|
Maximum (us)
|
Longest pulse width used for the PWM signals.
|
|
Connections
|
|
Channel 0
|
Pin on which to output PWM for the servo motor.
|
|
Angle
|
|
Angle 0
|
Range of movement in the servo motor to calibrate the Angle component macros. Can be found by measuring the angle between position 0 and position 255.
|
|
Trim
|
|
Trim Mode
|
|
|
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.
|
|
Simulation
|
|
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)).
|
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