Difference between revisions of "Component: Servo Motor (BL0162) (E-blocks 2)"

From Flowcode Help
Jump to navigationJump to search
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
+
{| style="width:50%"
 
 
{| width="50%"
 
 
|-
 
|-
| width="20%" style="color: gray;" | Author
+
| width="20%" style="color:gray;" | Author
 
| Matrix TSL
 
| Matrix TSL
 
|-
 
|-
| width="20%" style="color: gray;" | Version
+
| width="20%" style="color:gray;" | Version
| 1.0 (Release)
+
| 1.0
 
|-
 
|-
| width="20%" style="color: gray;" | Category
+
| width="20%" style="color:gray;" | Category
 
| E-blocks 2
 
| E-blocks 2
 
|}
 
|}
  
  
 +
==Servo Motor 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.
  
==[[File:Component Icon bc8ae960_3887_4d08_ac7c_1eedb8e5f6c8.png|Image]] Servo Motor (BL0162) component==
+
==Component Source Code==
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.
+
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_EBlocks2_Servo_BL0162.fcfx FC_Comp_Source_EBlocks2_Servo_BL0162.fcfx]
  
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.
+
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_EBlocks2_Servo_BL0162.fcfx FC_Comp_Source_EBlocks2_Servo_BL0162.fcfx]
  
==Examples==
+
==Detailed description==
''<span style="color:red;">No additional examples</span>''
 
  
  
==Downloadable macro reference==
 
  
===<span style="font-weight: normal;"><u><tt>DisableServo</tt></u></span>===
 
Disables a servo channel effectivly disabling the motor.
 
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''Channel''
 
::The channel to set the position for.  First channel is zero.
 
  
  
'''Return value'''
 
  
:''This call does not return a value''
 
  
  
===<span style="font-weight: normal;"><u><tt>SetPosition</tt></u></span>===
 
Moves directly to the specified position with no interpolation.
 
  
'''Parameters'''
+
''No detailed description exists yet for this component''
  
:[[Variable Types|BYTE]] ''Channel''
+
==Examples==
::The channel to set the position for.  First channel is zero.
 
  
:[[Variable Types|BYTE]] ''Position''
 
::Target position to move towards.
 
  
  
'''Return 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.
+
Example showing how to control three servos using AutoMoveToPosion, MoveTopposition & SetPosition component macros.<br>
 +
{{Fcfile|Controlling_Servos_Example.fcfx|Controlling Servos Example.fcfx}}<br><br>
  
Returns 0 if the servo movement is complete.
+
Example using BL0162 Servo controller for BL0055 Arduino Shield
  
'''Parameters'''
+
Samples the Port D8-D13 (portB) switches and moves the servo motors based on the input states.
  
:''This macro has no parameters''
+
D8 increments motor 0, D9 decrements motor on channel 0.
  
 +
D10 increments motor 1, D11 decrements motor on channel 1.
  
'''Return value'''
+
D12 increments motor 3, D13 decrements motor on channel 2.
  
:[[Variable Types|BYTE]]
+
Connections:
  
 +
Servo Board Port D0-D2.
  
===<span style="font-weight: normal;"><u><tt>MoveToPosition</tt></u></span>===
+
Switch Board Port D8 - D13
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'''
+
LCD A0 to A5 (PortC)
  
:[[Variable Types|BYTE]] ''Channel''
+
{{Fcfile|BL0162_Servo_BL0055.fcfx|BL0162 Servos Example for BL0055}}<br><br>
::The channel to set the position for.  First channel is zero.
 
  
:[[Variable Types|BYTE]] ''Position''
+
==Macro reference==
::Target position to move towards.
 
  
 +
===AutoMoveToPosition===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AutoMoveToPosition'''
 +
|-
 +
| colspan="2" | Automatically moves towards the new position with a fixed rate of 100 steps per second.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | The channel to set the position for.  First channel is zero.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Position
 +
|-
 +
| colspan="2" | Position to move to.&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Return value'''
 
  
:[[Variable Types|BYTE]] : 1 = reached target, 0 = target not reached.
+
===DisableServo===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DisableServo'''
 +
|-
 +
| colspan="2" | Disables a servo channel effectivly disabling the motor.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | The channel to set the position for.  First channel is zero.&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
===<span style="font-weight: normal;"><u><tt>SetTrim</tt></u></span>===
+
===EnableServo===
Allows the level of trim for each servo channel to be adjusted progmatically.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''EnableServo'''
 +
|-
 +
| colspan="2" | Enables a servo channel effectivly setting the position of the motor to the value in the local position variable.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | The channel to set the position for.  First channel is zero.&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''Channel''
+
===Initialise===
::The channel to set the position for.  First channel is zero.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 +
|-
 +
| colspan="2" | Sets up the servo motor interrupts&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:[[Variable Types|BYTE]] ''Trim''
 
::0=0us, 1=+25us, 2=+50us, 3=+75us, 4=+100us, 5=-25us, 6=-50us, 7=-75us, 8=-100us
 
  
 +
===IsAutoMoving===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''IsAutoMoving'''
 +
|-
 +
| colspan="2" | Is the AutoMoveToPosition movement complete. Returns 1 if the servo is still moving. Returns 0 if the servo movement is complete.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Return value'''
 
  
:''This call does not return a value''
+
===MoveToPosition===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MoveToPosition'''
 +
|-
 +
| colspan="2" | 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.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | The channel to set the position for.  First channel is zero.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Position
 +
|-
 +
| colspan="2" | Target position to move towards.&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
===<span style="font-weight: normal;"><u><tt>AutoMoveToPosition</tt></u></span>===
+
===SetAutoMoveSpeed===
Automatically moves towards the new position with a fixed rate of 100 steps per second.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetAutoMoveSpeed'''
 +
|-
 +
| colspan="2" | Sets the speed of the auto move to position macro. Default speed is 1.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Speed
 +
|-
 +
| colspan="2" | 1=Slowest (Default), 2= Double, 3=Triple, 4=Quadruple&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''Channel''
+
===SetPosition===
::The channel to set the position for.  First channel is zero.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetPosition'''
 +
|-
 +
| colspan="2" | Moves directly to the specified position with no interpolation.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | The channel to set the position for.  First channel is zero.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Position
 +
|-
 +
| colspan="2" | Target position to move towards.&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:[[Variable Types|BYTE]] ''Position''
 
::Position to move to.
 
  
 
+
===SetTrim===
'''Return value'''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
:''This call does not return a value''
+
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetTrim'''
 
+
|-
===<span style="font-weight: normal;"><u><tt>EnableServo</tt></u></span>===
+
| colspan="2" | Allows the level of trim for each servo channel to be adjusted progmatically.&nbsp;
Enables a servo channel effectivly setting the position of the motor to the value in the local position variable.
+
|-
 
+
|-
'''Parameters'''
+
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
+
| width="90%" | Channel
:[[Variable Types|BYTE]] ''Channel''
+
|-
::The channel to set the position for.  First channel is zero.
+
| colspan="2" | The channel to set the position for.  First channel is zero.&nbsp;
 
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
'''Return value'''
+
| width="90%" | Trim
 
+
|-
:''This call does not return a value''
+
| colspan="2" | 0=0us, 1=+25us, 2=+50us, 3=+75us, 4=+100us, 5=-25us, 6=-50us, 7=-75us, 8=-100us&nbsp;
 
+
|-
 
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
===<span style="font-weight: normal;"><u><tt>SetAutoMoveSpeed</tt></u></span>===
+
| width="90%" style="border-top: 2px solid #000;" | ''Return''
Sets the speed of the auto move to position macro.
+
|}
 
 
Default speed is 1.
 
 
 
'''Parameters'''
 
 
 
:[[Variable Types|BYTE]] ''Speed''
 
::1=Slowest (Default), 2= Double, 3=Triple, 4=Quadruple
 
 
 
 
 
'''Return value'''
 
 
 
:''This call does not return a value''
 
 
 
 
 
===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>===
 
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==
 
==Property reference==
<span style="font-weight: normal;"><u>Channels (1 - 8)</u></span>
 
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Servo_Controller1::Channel_Count''.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
Set the number of servo's that you need to control.
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
Value from 1 to 8.
+
|-
 
+
|-
<span style="font-weight: normal;"><u>Channel 0</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Channels (1 - 8)
This property is of type ''Single digital pin'' and can be referenced with the variable name ''Servo_Controller1::pin0''.
+
|-
 
+
| colspan="2" | Set the number of servo's that you need to control. Value from 1 to 8.&nbsp;
Pin on which to output PWM for the servo motor.
+
|-
 
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
<span style="font-weight: normal;"><u>Channel 1</u></span>
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections
 
+
|-
This property is of type ''Single digital pin'' and can be referenced with the variable name ''Servo_Controller1::pin1''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
Pin on which to output PWM for the servo motor.
+
| width="90%" | Channel 0
 
+
|-
<span style="font-weight: normal;"><u>Channel 2</u></span>
+
| colspan="2" | Pin on which to output PWM for the servo motor.&nbsp;
 
+
|-
This property is of type ''Single digital pin'' and can be referenced with the variable name ''Servo_Controller1::pin2''.
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | Channel 1
Pin on which to output PWM for the servo motor.
+
|-
 
+
| colspan="2" | Pin on which to output PWM for the servo motor.&nbsp;
<span style="font-weight: normal;"><u>Channel 3</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
This property is of type ''Single digital pin'' and can be referenced with the variable name ''Servo_Controller1::pin3''.
+
| width="90%" | Channel 2
 
+
|-
Pin on which to output PWM for the servo motor.
+
| colspan="2" | Pin on which to output PWM for the servo motor.&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Channel 4</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | Channel 3
This property is of type ''Single digital pin'' and can be referenced with the variable name ''Servo_Controller1::pin4''.
+
|-
 
+
| colspan="2" | Pin on which to output PWM for the servo motor.&nbsp;
Pin on which to output PWM for the servo motor.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
<span style="font-weight: normal;"><u>Channel 5</u></span>
+
| width="90%" | Channel 4
 
+
|-
This property is of type ''Single digital pin'' and can be referenced with the variable name ''Servo_Controller1::pin5''.
+
| colspan="2" | Pin on which to output PWM for the servo motor.&nbsp;
 
+
|-
Pin on which to output PWM for the servo motor.
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | Channel 5
<span style="font-weight: normal;"><u>Channel 6</u></span>
+
|-
 
+
| colspan="2" | Pin on which to output PWM for the servo motor.&nbsp;
This property is of type ''Single digital pin'' and can be referenced with the variable name ''Servo_Controller1::pin6''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
Pin on which to output PWM for the servo motor.
+
| width="90%" | Channel 6
 
+
|-
<span style="font-weight: normal;"><u>Channel 7</u></span>
+
| colspan="2" | Pin on which to output PWM for the servo motor.&nbsp;
 
+
|-
This property is of type ''Single digital pin'' and can be referenced with the variable name ''Servo_Controller1::pin7''.
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | Channel 7
Pin on which to output PWM for the servo motor.
+
|-
 
+
| colspan="2" | Pin on which to output PWM for the servo motor.&nbsp;
<span style="font-weight: normal;"><u>Minimum (us)</u></span>
+
|-
 
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''Servo_Controller1::min_pulse_width''.
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Pulse Width
 
+
|-
Shortest pulse width that will be used.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
<span style="font-weight: normal;"><u>Maximum (us)</u></span>
+
| width="90%" | Minimum (us)
 
+
|-
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''Servo_Controller1::max_pulse_width''.
+
| colspan="2" | Shortest pulse width that will be used.&nbsp;
 
+
|-
Longest pulse width used for the PWM signals.
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Maximum (us)
<span style="font-weight: normal;"><u>Trim 0</u></span>
+
|-
 
+
| colspan="2" | Longest pulse width used for the PWM signals.&nbsp;
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Servo_Controller1::trim0''.
+
|-
 
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
Trim the pulse width for this channel. Use this to trim the positioning of two servos so that similar
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Trim
 
+
|-
input values will produce the same degree of movement.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
<span style="font-weight: normal;"><u>Trim 1</u></span>
+
| width="90%" | Trim 0
 
+
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Servo_Controller1::trim1''.
+
| colspan="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.&nbsp;
 
+
|-
Trim the pulse width for this channel.  Use this to trim the positioning of two servos so that similar
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Trim 1
input values will produce the same degree of movement.
+
|-
 
+
| colspan="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.&nbsp;
<span style="font-weight: normal;"><u>Trim 2</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Servo_Controller1::trim2''.
+
| width="90%" | Trim 2
 
+
|-
Trim the pulse width for this channel.  Use this to trim the positioning of two servos so that similar
+
| colspan="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.&nbsp;
 
+
|-
input values will produce the same degree of movement.
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Trim 3
<span style="font-weight: normal;"><u>Trim 3</u></span>
+
|-
 
+
| colspan="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.&nbsp;
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Servo_Controller1::trim3''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
Trim the pulse width for this channel.  Use this to trim the positioning of two servos so that similar
+
| width="90%" | Trim 4
 
+
|-
input values will produce the same degree of movement.
+
| colspan="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.&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Trim 4</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Trim 5
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Servo_Controller1::trim4''.
+
|-
 
+
| colspan="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.&nbsp;
Trim the pulse width for this channel.  Use this to trim the positioning of two servos so that similar
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
input values will produce the same degree of movement.
+
| width="90%" | Trim 6
 
+
|-
<span style="font-weight: normal;"><u>Trim 5</u></span>
+
| colspan="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.&nbsp;
 
+
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Servo_Controller1::trim5''.
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Trim 7
Trim the pulse width for this channel.  Use this to trim the positioning of two servos so that similar
+
|-
 
+
| colspan="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.&nbsp;
input values will produce the same degree of movement.
+
|-
 
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
<span style="font-weight: normal;"><u>Trim 6</u></span>
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
 
+
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Servo_Controller1::trim6''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
Trim the pulse width for this channel.  Use this to trim the positioning of two servos so that similar
+
| width="90%" | Show Servo Interface
 
+
|-
input values will produce the same degree of movement.
+
| colspan="2" | &nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Trim 7</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
 
+
| width="90%" | Servo Object 0
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Servo_Controller1::trim7''.
+
|-
 
+
| colspan="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)).&nbsp;
Trim the pulse width for this channel.  Use this to trim the positioning of two servos so that similar
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
input values will produce the same degree of movement.
+
| width="90%" | Servo Object 1
 
+
|-
<span style="font-weight: normal;"><u>Servo Object 0</u></span>
+
| colspan="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)).&nbsp;
 
+
|-
This property is of type ''Panel object'' and can be referenced with the variable name ''Servo_Controller1::sim0''.
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
 
+
| width="90%" | Servo Object 2
Drag a servo motor component onto the System Panel, and then select it here, to create
+
|-
 
+
| colspan="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)).&nbsp;
an on screen simulation of the way that your flowchart moves the servo's.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
Servo motors should be based on the 'Servo Motor Base' component, or use a custom component
+
| width="90%" | Servo Object 3
 
+
|-
set to responf to 'User.Notify' events (ID = n/a, Data = Position (0-127)).
+
| colspan="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)).&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Servo Object 1</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
 
+
| width="90%" | Servo Object 4
This property is of type ''Panel object'' and can be referenced with the variable name ''Servo_Controller1::sim1''.
+
|-
 
+
| colspan="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)).&nbsp;
Drag a servo motor component onto the System Panel, and then select it here, to create
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
an on screen simulation of the way that your flowchart moves the servo's.
+
| width="90%" | Servo Object 5
 
+
|-
Servo motors should be based on the 'Servo Motor Base' component, or use a custom component
+
| colspan="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)).&nbsp;
 
+
|-
set to responf to 'User.Notify' events (ID = n/a,  Data = Position (0-127)).
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
 
+
| width="90%" | Servo Object 6
<span style="font-weight: normal;"><u>Servo Object 2</u></span>
+
|-
 
+
| colspan="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)).&nbsp;
This property is of type ''Panel object'' and can be referenced with the variable name ''Servo_Controller1::sim2''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
Drag a servo motor component onto the System Panel, and then select it here, to create
+
| width="90%" | Servo Object 7
 
+
|-
an on screen simulation of the way that your flowchart moves the servo's.
+
| colspan="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)).&nbsp;
 
+
|}
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)).
 
 
 
<span style="font-weight: normal;"><u>Servo Object 3</u></span>
 
 
 
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)).
 
 
 
<span style="font-weight: normal;"><u>Servo Object 4</u></span>
 
 
 
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)).
 
 
 
<span style="font-weight: normal;"><u>Servo Object 5</u></span>
 
 
 
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)).
 
 
 
<span style="font-weight: normal;"><u>Servo Object 6</u></span>
 
 
 
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)).
 
 
 
<span style="font-weight: normal;"><u>Servo Object 7</u></span>
 
 
 
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)).
 

Latest revision as of 11:20, 29 January 2025

Author Matrix TSL
Version 1.0
Category E-blocks 2


Servo Motor 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.

Component Source Code

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

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

Detailed description

No detailed description exists yet for this component

Examples

Example showing how to control three servos using AutoMoveToPosion, MoveTopposition & SetPosition component macros.
FC6 Icon.png 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)

FC6 Icon.png BL0162 Servos Example for BL0055

Macro reference

AutoMoveToPosition

Fc9-comp-macro.png AutoMoveToPosition
Automatically moves towards the new position with a fixed rate of 100 steps per second. 
Fc9-u8-icon.png - BYTE Channel
The channel to set the position for. First channel is zero. 
Fc9-u8-icon.png - BYTE Position
Position to move to. 
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 servo is still moving. Returns 0 if the servo movement is complete. 
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 set the position for. First channel is zero. 
Fc9-u8-icon.png - BYTE Position
Target position to move towards. 
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 1. 
Fc9-u8-icon.png - BYTE 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 set the position for. First channel is zero. 
Fc9-u8-icon.png - BYTE Position
Target position to move towards. 
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
0=0us, 1=+25us, 2=+50us, 3=+75us, 4=+100us, 5=-25us, 6=-50us, 7=-75us, 8=-100us 
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 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-conn-icon.png Trim
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 Simulation
Fc9-type-7-icon.png Show Servo Interface
 
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)).