Communication handling for writing to a MotoLogix system.
Version history
1.0.0
Changes
commandsInUseoutput for monitoring the command bufferfill level
- unused internal variables
show full history
0.1.0
Changes
- source code ported
- version number reset
- now using semantic versioning
Overview
| kind | name | type | default | comment |
|---|---|---|---|---|
| input | FirstScan | BOOL | first scan after startup of plc | |
| output | commandsInUse | SINT | number of slots in the command buffer currently in use | |
| in_out | MLX_Output | ARRAY[0..435] OF USINT | ||
| in_out | MLX | MLxData | The MLxData Controller Scope tag. |
Details
FirstScan
BOOLMust be True for the first scan after startup of plc.
commandsInUse
SINTNumber of slots in the command buffer currently in use. It helps to understand what fill levels the command buffer reaches when running your MotoLogix application.
Each enabled instance of a MotoLogix function (except sytem- and PLC internal commands) occupies a slot in the command buffer for the length of its lifecycle.
A function block that gets triggered when the command buffer is already full will fail (
Sts_ERstatus).
MLX_Output
ARRAY[0..435] OF USINTOutput data buffer (mapped to fieldbus IO).
MLX
MLxDataThe MotoLogix variable which acts as the shared memory for a MotoLogix system.
As the PLC runs through its scan cycle each active MotoLogix FB will read from- and write to this MotoLogix variable.
It is also used for processing the data red from- and sent to the robot controller.
There are a few important rules:
MLxCommunicationReadmust be called at the very beginning of the PLC scan cycle.MLxCommunicationWritemust be called at the very end of the PLC scan cycle.- All other MotoLogix FB’s used in your application must be called inbetween.
- All off this must be handled by the same PLC task, respecting above rules.
Failing to follow above rules can lead to inconsistent data being sent to the robot controller which could result in unexpected motion.
Implementation
fbCommunicationWrite : ARRAY[0..0] OF MLxCommunicationWrite;
// fbCommunicationWrite[0].FirstScan := ;
fbCommunicationWrite[0]( MLX_Output := dummy, MLX := dummy );
// := fbCommunicationWrite[0].commandsInUse;