Difference between revisions of "Component: Servo Controller (Mechatronics)"
(XML import) |
(XML import BR) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 7: | Line 7: | ||
|- | |- | ||
| width="20%" style="color: gray;" | Version | | width="20%" style="color: gray;" | Version | ||
− | | 1. | + | | 1.5 (Release) |
|- | |- | ||
| width="20%" style="color: gray;" | Category | | width="20%" style="color: gray;" | Category | ||
Line 19: | Line 19: | ||
'Servo Object' properties allow you to connect the controller to on-screen simulations | 'Servo Object' properties allow you to connect the controller to on-screen simulations | ||
using the "Servo Motor" component and its derivatives. | using the "Servo Motor" component and its derivatives. | ||
− | |||
Line 25: | Line 24: | ||
===Importing from v5=== | ===Importing from v5=== | ||
− | The servo component in Flowcode v6 has a new Initialise macro which will need to be added to your program before any other calls to the servo motor component are made. | + | The servo component in Flowcode v6 and v7 has a new Initialise macro which will need to be added to your program before any other calls to the servo motor component are made. |
Line 110: | Line 109: | ||
:''This call does not return a value'' | :''This call does not return a value'' | ||
+ | |||
+ | |||
+ | ===<span style="font-weight: normal;"><u><tt>IsAutoMoving</tt></u></span>=== | ||
+ | Is the AutoMoveToPosition movement complete. | ||
+ | |||
+ | Returns 1 if the servo is still moving. | ||
+ | |||
+ | Returns 0 if the servo movement is complete. | ||
+ | |||
+ | '''Parameters''' | ||
+ | |||
+ | :''This macro has no parameters'' | ||
+ | |||
+ | |||
+ | '''Return value''' | ||
+ | |||
+ | :[[Variable Types|BYTE]] | ||
Line 151: | Line 167: | ||
:[[Variable Types|BYTE]] ''Speed'' | :[[Variable Types|BYTE]] ''Speed'' | ||
+ | ::1=Slowest (Default), 2= Double, 3=Triple, 4=Quadruple | ||
Latest revision as of 15:46, 16 February 2017
Author | Matrix Ltd |
Version | 1.5 (Release) |
Category | Mechatronics |
Contents
Servo Controller component
Can control up to eight standard PWM driven servo's. 'Servo Object' properties allow you to connect the controller to on-screen simulations using the "Servo Motor" component and its derivatives.
Examples
Importing from v5
The servo component in Flowcode v6 and v7 has a new Initialise macro which will need to be added to your program before any other calls to the servo motor component are made.
Controlling a servo with an analogue input
This example reads the value of the analogue potentiometer and uses this to set the position of the servo motor.
Servo Example 1
The Servo controller is linked to the standard servo component but this could be linked to any object on the panel.
Creating a multi-axis actuator using servo motors
This example links two servo motors together using panel primitive objects and groups.
Servo Example 2
The Servo controller can handle up to 8 motors and is used to control both of the standard servo components on the panel.
Downloadable macro reference
DisableServo
Disables a servo channel effectivly disabling the motor.
Parameters
- BYTE Channel
- The channel to set the position for. First channel is zero.
Return value
- This call does not return a value
SetPosition
Moves directly to the specified position with no interpolation.
Parameters
- BYTE Channel
- The channel to set the position for. First channel is zero.
- BYTE Position
- Target position to move towards.
Return value
- This call does not return a value
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.
Parameters
- BYTE Channel
- The channel to set the position for. First channel is zero.
- BYTE Position
- Target position to move towards.
Return value
- BYTE : 1 = reached target, 0 = target not reached.
SetTrim
Allows the level of trim for each servo channel to be adjusted progmatically.
Parameters
- BYTE Channel
- The channel to set the position for. First channel is zero.
- BYTE Trim
- 0=0us, 1=+25us, 2=+50us, 3=+75us, 4=+100us, 5=-25us, 6=-50us, 7=-75us, 8=-100us
Return value
- This call does not return a value
IsAutoMoving
Is the AutoMoveToPosition movement complete.
Returns 1 if the servo is still moving.
Returns 0 if the servo movement is complete.
Parameters
- This macro has no parameters
Return value
AutoMoveToPosition
Automatically moves towards the new position with a fixed rate of 100 steps per second.
Parameters
- BYTE Channel
- The channel to set the position for. First channel is zero.
- BYTE Position
- Position to move to.
Return value
- This call does not return a value
EnableServo
Enables a servo channel effectivly setting the position of the motor to the value in the local position variable.
Parameters
- BYTE Channel
- The channel to set the position for. First channel is zero.
Return value
- This call does not return a value
SetAutoMoveSpeed
Sets the speed of the auto move to position macro.
Default speed is 1.
Parameters
- BYTE Speed
- 1=Slowest (Default), 2= Double, 3=Triple, 4=Quadruple
Return value
- This call does not return a value
Initialise
Sets up the servo motor interrupts
Parameters
- This macro has no parameters
Return value
- This call does not return a value
Simulation macro reference
This component does not contain any simulation macros
Property reference
Channels (1 - 8)
This property is of type Fixed list of ints and can be referenced with the variable name Channel_Count.
Set the number of servo's that you need to control.
Value from 1 to 8.
Channel 0
This property is of type Single digital pin and can be referenced with the variable name pin0.
Pin on which to output PWM for the servo motor.
Trim 0
This property is of type Fixed list of ints and can be referenced with the variable name trim0.
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.
Minimum (us)
This property is of type Unsigned integer and can be referenced with the variable name min_pulse_width.
Shortest pulse width that will be used.
Maximum (us)
This property is of type Unsigned integer and can be referenced with the variable name max_pulse_width.
Longest pulse width used for the PWM signals.
Servo Object 0
This property is of type Panel object and can be referenced with the variable name sim0.
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)).