Motion Library - Block
Name | Description | Return type |
MLBlkCreate | Creates a new Pipe Block object | None |
MLBlkIsReady | Checks if a Pipe Block currently has a function running | BOOL |
MLBlkReadModPos | Gets the value of the period of a block in user units | None |
MLBlkReadOutVal | Gets the output value of a selected Pipe Block | None |
MLBlkWriteModPos | Sets the value of the period of a block in user units | BOOL |
MLBlkCreate
Description
-
-
Pipe Blocks are normally created in the Pipe Network using the graphical engine. Then you do not have to add MLBlkCreate function blocks to their programs. Blocks are created graphically, and the code with MLBlkCreate commands are automatically generated and called in a program with Pipe Network(MLPN_CREATE_OBJECTS).
-
-
This function should be called after MLMotionInit is called and before MLMotionStart is called.
Arguments
Input
Name |
Description |
Desired name for the newly created Pipe Block |
Data type |
String |
|
Range |
— |
|
Unit |
N/A |
|
Default |
— |
|
Type |
Description |
Type of Pipe Block to create (ex. MASTER, GEAR, PHASER, etc.) |
Data type |
String |
|
Range |
— |
|
Unit |
N/A |
|
Default |
— |
Output
ID |
Description |
Assigned ID number of the created Block |
Data type |
DINT |
|
Unit |
N/A |
|
Default |
— |
Related Functions
PipeNetwork(MLPN_CREATE_OBJECTS)
Example
Structured Text
//Create a new GEAR Pipe Block named “MyGear”
MyGear := MLBlkCreate( 'MyGear', 'GEAR' );
Ladder Diagram
Function Block Diagram
MLBlkReadOutVal
Description
Get the output value a selected Pipe Block.
-
-
This function or function block returns cached data. See Programming a Dual Core Controller for more information.
Arguments
Input
ID |
Description |
ID number of a created Pipe Block |
Data type |
DINT |
|
Range |
[-2147483648, 2147483648] |
|
Unit |
N/A |
|
Default |
— |
Output
Value |
Description |
Current output value of the selected Pipe Block |
Data type |
LREAL |
|
Unit |
N/A |
|
Default |
— |
Related Functions
Example
Structured Text
//Save the output of a Gear Pipe Block BlockOutput := MLBlkReadOutVal( PipeNetwork.MyGear );
|
Ladder Diagram
Function Block Diagram
MLBlkReadModPos
Description
Get the value of the period of a block in user units. The output value of a block is reset each time it reaches its period value.
Arguments
Input
ID |
Description |
ID number of a created Pipe Block |
Data type |
DINT |
|
Range |
[-2147483648, 2147483648] |
|
Unit |
N/A |
|
Default |
— |
Output
ModuloPosition |
Description |
Current Period Value for selected Pipe Block |
Data type |
LREAL |
|
Unit |
User unit |
|
Default |
— |
Related Functions
Example
Structured Text
//Return and save the Period of a Pipe Block GearPeriod := MLBlkReadModPos( PipeNetwork.MyGear );
|
Ladder Diagram
Function Block Diagram
MLBlkIsReady
Description
Check if a block is ready. Returns FALSE if the selected Pipe Block has a function running. Returns TRUE if no function of a specified Pipe Block is running.
-
-
Same return value as the .Q output of a specific function itself.
-
-
This function or function block returns cached data. See Programming a Dual Core Controller for more information.
Arguments
Input
ID |
Description |
ID number of a created Pipe Block |
Data type |
DINT |
|
Range |
[-2147483648, 2147483648] |
|
Unit |
N/A |
|
Default |
— |
Output
Default (.Q) |
Description |
Returns TRUE if no function of a specified Pipe Block is running. See more details here. |
Data type |
BOOL |
|
Unit |
N/A |
Return Type
BOOL
Related Functions
Example
Structured Text
//Check if the MST Pipe Block named “MASTER” has a function running
IsReady := MLBlkIsReady( PipeNetwork.MASTER );
Ladder Diagram
Function Block Diagram
MLBlkWriteModPos
Description
Set the value of the period of a block in user units. The output value of a block is reset each time it reaches its period value.
Arguments
Input
ID |
Description |
ID number of a created Pipe Block |
Data type |
DINT |
|
Range |
[-2147483648, 2147483648] |
|
Unit |
N/A |
|
Default |
— |
|
ModuloPosition |
Description |
Desired new Period Value for selected Pipe Block |
Data type |
LREAL |
|
Range |
— |
|
Unit |
User unit |
|
Default |
— |
Output
Default (.Q) |
Description |
Returns TRUE if the function block executes See more details here. |
Data type |
BOOL |
|
Unit |
N/A |
Return Type
BOOL
Related Functions
Example
Structured Text
//Set the Period of a Pipe Block to 300 MLBlkWriteModPos( PipeNetwork.MyGear, 300 );
|
Ladder Diagram
Function Block Diagram