FB_KL6811Communication
The function blocks for the DALI commands do not directly access the process image of the KL6811, but place the individual DALI commands in a command buffer. The function block FB_KL6811Communication sequentially reads the DALI commands from the command buffer and forwards them to the KL6811. This prevents multiple function blocks accessing the KL6811 process image at the same time.
Most function blocks have the input eCommandPriority, which has no function when using the KL6811. Priorities for the DALI commands are only supported from DALI-2 onwards. |
One instance of the function block FB_KL6811Communication is required per KL6811. This instance must be called in a separate, faster task. This faster communication task must have a higher priority than the task in which the function blocks for the individual DALI commands are called.
The utilization rate of the command buffer can be determined using the outputs of the function block. If you find that the command buffer is overflowing regularly, you should take the following steps:
- How heavily are the individual PLC tasks utilized? TwinCAT provides suitable analysis tools.
- Try to reduce the cycle time of the task in which the function block FB_KL6811Communication is called. The value should not be greater than 6 ms. The optimum value is 2 ms or less.
- If possible avoid polling (regular reading) of values. Only read values when they are actually required.
- Distribute the individual DALI control gears evenly over several DALI lines. Since several DALI lines are processed simultaneously in each PLC cycle, this increases the data throughput.
For more information, see the chapter Bus Timing.
Inputs
VAR_INPUT
bResetMaximumDemandCounter : BOOL;
bResetOverflowCounter : BOOL;
nOptions : DWORD;
bInitialise : BOOL := FALSE;
bDisableInternalPowerSupply : BOOL := FALSE;
END_VAR
Name | Type | Description |
---|---|---|
bResetMaximumDemandCounter | BOOL | A positive edge resets the stored value for the maximum utilization of the command buffer, nBufferMaximumDemandMeter (0…100%). |
bResetOverflowCounter | BOOL | A positive edge resets the stored value for the number of overflows of the command buffer, nBufferOverflowCounter. |
nOptions | DWORD | Reserved for future extensions. |
bInitialise | BOOL | Configuration of the bus terminal is started by a positive edge at this input. Initialization is also carried out automatically when the controller is started. During this time no DALI commands are processed. |
bDisableInternalPowerSupply | BOOL | Defines the operation mode of the internal DALI power supply. The value is written to the terminal by a positive edge at input bInitialise and stored there persistently. |
Inputs/outputs
VAR_IN_OUT
stInData : ST_KL6811InData;
stOutData : ST_KL6811OutData;
END_VAR
Name | Type | Description |
---|---|---|
stInData | Structure in the input process image of the KL6811. It is used for communication from the KL6811 to the PLC. | |
stOutData | Structure in the output process image of the KL6811. It is used for communication from the PLC to the KL6811. |
Outputs
VAR_OUTPUT
bError : BOOL;
ipResultMessage : I_TcMessage;
bBusy : BOOL;
nBufferDemandMeter : BYTE;
nBufferMaximumDemandMeter : BYTE;
nBufferOverflowCounter : UINT;
bCollisionErrorFC : BOOL;
bCollisionErrorBC : BOOL;
bPowerSupplyError : BOOL;
bInitialising : BOOL;
nTerminalDescription : WORD;
nFirmwareVersion : WORD;
END_VAR
Name | Type | Description |
---|---|---|
bError | BOOL | This output is switched to TRUE if an error occurs during the execution. Further information about the error can be queried via the variable ipResultMessage. The output is set to FALSE again as soon as bBusy switches to TRUE. |
ipResultMessage | I_TcMessage | Interface pointer (see error evaluation) that can be used to obtain detailed information about the processing of the function block (see runtime messages). The interface pointer is valid after bBusy has changed from TRUE to FALSE. |
bBusy | BOOL | The output is set as soon as execution of the DALI commands has commenced. It remains active until all DALI commands have been processed. |
nBufferDemandMeter | BYTE | Utilization rate of the command buffer (0…100 %). |
nBufferMaximumDemandMeter | BYTE | Maximum utilization rate of the command buffer reached so far (0…100 %). The counter can be reset via the input bResetMaximumDemandCounter. |
nBufferOverflowCounter | UINT | Number of command buffer overflows to date. The counter can be reset via the input bResetOverflowCounter. |
bCollisionErrorFC | BOOL | If the output is TRUE, a DALI collision was detected on the forward channel. This can mean that a collision with the send data of another DALI control device was detected during the transmission of a DALI frame. The output is automatically set to FALSE again as soon as no collision has occurred on the forward channel during transmission. |
bCollisionErrorBC | BOOL | If the output is TRUE, a DALI collision was detected on the backward channel. This can mean that a collision with the send data of another DALI device was detected during the transmission of a DALI frame. The output is automatically set to FALSE again as soon as no collision has occurred on the backward channel during transmission. |
bPowerSupplyError | BOOL | If the output is TRUE, an overload was detected when using the internal DALI power supply unit of the bus terminal (bus undervoltage). |
bInitialising | BOOL | During initialization of the bus terminal, the output is set and remains active until initialization has been completed. Initialization is also carried out automatically when the controller is started. During this time no DALI commands are processed. |
nTerminalDescription | WORD | Contains the Terminal Name (e.g. 6811). This information is contained in register 8 of the bus terminal. |
nFirmwareVersion | WORD | Contains the firmware version. This information is contained in register 9 of the bus terminal. |
Properties
Name | Type | Access | Initial value | Description |
---|---|---|---|---|
ipDALICommunication | I_DALICommunication | Get,Set | 0 | Interface Pointer to the communication block (see Transfer of the reference to the communication block). |
Requirements
Development environment | Required PLC library |
---|---|
TwinCAT from v3.1.4024.11 | Tc3_DALI from v3.5.0.0 |