Difference between revisions of "Component: Servo Motor (BL0162) (E-blocks 2)"
Line 20: | Line 20: | ||
There are component macros in flowcode which allow you to set the level of trim for each servo channel, and to move it to a certain position. Before you can allow the servo to connect you must use the initialise macro in the program and also the ‘EnableServo’ to specify which servo you are communicating with. There is also a ‘DisableServo’ macro you can use to disable a servo channel again. | There are component macros in flowcode which allow you to set the level of trim for each servo channel, and to move it to a certain position. Before you can allow the servo to connect you must use the initialise macro in the program and also the ‘EnableServo’ to specify which servo you are communicating with. There is also a ‘DisableServo’ macro you can use to disable a servo channel again. | ||
+ | |||
Make sure the channels are all connected to the correct port and pin, the port will correspond to the port the servo motor is connected to on the E-blocks 2 upstream board you are using. | Make sure the channels are all connected to the correct port and pin, the port will correspond to the port the servo motor is connected to on the E-blocks 2 upstream board you are using. | ||
Revision as of 14:42, 7 September 2018
Author | Matrix TSL |
Version | 1.0 (Release) |
Category | E-blocks 2 |
Contents
Servo Motor (BL0162) component
Servo motor component to drive the E-blocks 2 BL0162 Servo Motors board. Provides up to eight individually addressable connections for standard DC servo motors to be connected.
There are component macros in flowcode which allow you to set the level of trim for each servo channel, and to move it to a certain position. Before you can allow the servo to connect you must use the initialise macro in the program and also the ‘EnableServo’ to specify which servo you are communicating with. There is also a ‘DisableServo’ macro you can use to disable a servo channel again.
Make sure the channels are all connected to the correct port and pin, the port will correspond to the port the servo motor is connected to on the E-blocks 2 upstream board you are using.
Examples
No additional examples
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
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
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
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 Servo_Controller1::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 Servo_Controller1::pin0.
Pin on which to output PWM for the servo motor.
Channel 1
This property is of type Single digital pin and can be referenced with the variable name Servo_Controller1::pin1.
Pin on which to output PWM for the servo motor.
Channel 2
This property is of type Single digital pin and can be referenced with the variable name Servo_Controller1::pin2.
Pin on which to output PWM for the servo motor.
Channel 3
This property is of type Single digital pin and can be referenced with the variable name Servo_Controller1::pin3.
Pin on which to output PWM for the servo motor.
Channel 4
This property is of type Single digital pin and can be referenced with the variable name Servo_Controller1::pin4.
Pin on which to output PWM for the servo motor.
Channel 5
This property is of type Single digital pin and can be referenced with the variable name Servo_Controller1::pin5.
Pin on which to output PWM for the servo motor.
Channel 6
This property is of type Single digital pin and can be referenced with the variable name Servo_Controller1::pin6.
Pin on which to output PWM for the servo motor.
Channel 7
This property is of type Single digital pin and can be referenced with the variable name Servo_Controller1::pin7.
Pin on which to output PWM for the servo motor.
Minimum (us)
This property is of type Unsigned integer and can be referenced with the variable name Servo_Controller1::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 Servo_Controller1::max_pulse_width.
Longest pulse width used for the PWM signals.
Trim 0
This property is of type Fixed list of ints and can be referenced with the variable name Servo_Controller1::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.
Trim 1
This property is of type Fixed list of ints and can be referenced with the variable name Servo_Controller1::trim1.
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.
Trim 2
This property is of type Fixed list of ints and can be referenced with the variable name Servo_Controller1::trim2.
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.
Trim 3
This property is of type Fixed list of ints and can be referenced with the variable name Servo_Controller1::trim3.
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.
Trim 4
This property is of type Fixed list of ints and can be referenced with the variable name Servo_Controller1::trim4.
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.
Trim 5
This property is of type Fixed list of ints and can be referenced with the variable name Servo_Controller1::trim5.
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.
Trim 6
This property is of type Fixed list of ints and can be referenced with the variable name Servo_Controller1::trim6.
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.
Trim 7
This property is of type Fixed list of ints and can be referenced with the variable name Servo_Controller1::trim7.
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.
Servo Object 0
This property is of type Panel object and can be referenced with the variable name Servo_Controller1::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)).
Servo Object 1
This property is of type Panel object and can be referenced with the variable name Servo_Controller1::sim1.
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)).
Servo Object 2
This property is of type Panel object and can be referenced with the variable name Servo_Controller1::sim2.
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)).
Servo Object 3
This property is of type Panel object and can be referenced with the variable name Servo_Controller1::sim3.
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)).
Servo Object 4
This property is of type Panel object and can be referenced with the variable name Servo_Controller1::sim4.
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)).
Servo Object 5
This property is of type Panel object and can be referenced with the variable name Servo_Controller1::sim5.
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)).
Servo Object 6
This property is of type Panel object and can be referenced with the variable name Servo_Controller1::sim6.
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)).
Servo Object 7
This property is of type Panel object and can be referenced with the variable name Servo_Controller1::sim7.
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)).