FB_EL6851CommunicationEx

The EL6851 should always be accessed via this function block. This applies both to the transmission of the cyclic DMX data and to the transmission of the RDM commands.
If data is to be transmitted cyclically to the DMX devices, then set the bEnableSendingData input to TRUE, the bSetCycleMode input to TRUE, the bSendDefaultData input to FALSE and the uiDataLength input to the corresponding length (in bytes). The data to be transmitted can be specified via the arrProcessData variable.
If RDM commands are to be transmitted, then set the bEnableSendingData input to FALSE and the bSetCycleMode input to FALSE. The function blocks for the DMX/RDM commands do not directly access the EL6851 process image, but store the individual DMX/RDM commands in a buffer instead. The function block FB_EL6851CommunicationEx() reads the commands sequentially from this buffer and forwards them to the EL6851. This prevents multiple function blocks accessing the EL6851 process image at the same time. The buffer in which the DMX/RDM commands are stored is contained in a variable of type ST_DMXCommandBuffer. There is one instance of the function block FB_EL6851CommunicationEx() and one variable of type ST_DMXCommandBuffer per EL6851.
The extent to which the buffer is utilized can be determined from the outputs of the function block. If the buffer is regularly overflowing, you should analyze the level of utilization of the PLC task with the aid of the TwinCAT System Manager.
The function block FB_EL6851CommunicationEx() can be called in a separate faster task, if necessary. In this case, the faster task in which the function block FB_EL6851CommunicationEx() is called should have a higher priority than the TASK in which the function block for the RDM commands is called.
Examples for both operation modes can be found in the appendix.
Remarks concerning the IDs of DMX devices
Each DMX device has a unique, fixed, 48-bit long address, also called Unique ID or UID for short. This address is composed of the manufacturer ID (16-bit) and the device ID (32-bit). The manufacturer ID identifies the manufacturer of the device and is issued by the ESTA (Entertainment Services and Technology Association). A list of all known manufacturer IDs can be found at http://www.esta.org/tsp/working_groups/CP/mfctrIDs.php. The device ID is freely specified by the manufacturer. This is intended to ensure that each UID exists only once worldwide. The UID cannot normally be changed. The ESTA has given Beckhoff Automation the manufacturer ID 0x4241. Since the DMX master also has a UID, this should be specified in accordance with the ESTA (wSourceManufacturerId input).
Inputs
VAR_INPUT
wSourceManufacturerId : WORD := 16#42_41;
dwSourceDeviceId : DWORD := 16#12_13_14_15;
bEnableSendingData : BOOL := TRUE;
bSetCycleMode : BOOL := TRUE;
bSendDefaultData : BOOL;
uiDataLength : UINT;
dwOptions : DWORD;
END_VAR
Name | Type | Description |
---|---|---|
wSourceManufacturerId | WORD | Unique manufacturer Id of the DMX device. Should be 0x4241 according to the ESTA. |
dwSourceDeviceId | DWORD | Unique device Id of the DMX device. Can be freely assigned. |
bEnableSendingData | BOOL | If the terminal is in CycleMode (CycleMode output = TRUE), then transmission can be activated (TRUE) or blocked (FALSE) with this function block. |
bSetCycleMode | BOOL | Activates the CycleMode. The cyclic process data can be transmitted to the DMX devices in CycleMode. CycleMode must be disabled in order to transmit the RDM/DMX commands. |
bSendDefaultData | BOOL | The default values will be transmitted in CycleMode if this input is active (TRUE). |
uiDataLength | UINT | This input is only relevant if CycleMode is active. It indicates the length of the DMX512 frame in bytes. |
dwOptions | DWORD | Options (currently not used). |
Requirements
Development environment | required TC3 PLC library |
---|---|
TwinCAT from v3.1.4020.14 | Tc2_DMX from 3.5.3.0 |
Inputs/outputs
VAR_IN_OUT
stEL6851InData : ST_EL6851InData;
stEL6851OutData : ST_EL6851OutData;
stCommandBuffer : ST_DMXCommandBuffer;
arrProcessData : ARRAY [1..512] OF BYTE;
END_VAR
Name | Type | Description |
---|---|---|
stEL6851InData |
Structure in the EL6851 input process image. It is used for communication from the EL6851 to the PLC. | |
stEL6851OutData |
Structure in the EL6851 output process image. It is used for communication from the PLC to the EL6851. | |
stCommandBuffer |
Reference to the structure for communication (buffer) with the function block FB_EL6851Communication() | |
arrProcessData |
ARRAY OF BYTE |
The data that are to be transmitted cyclically to the DMX devices are transferred to the function block via this variable. For this the CycleMode must be active (see also input bSetCycleMode). |
Outputs
VAR_OUTPUT
bError : BOOL;
udiErrorId : UDINT;
bCycleMode : BOOL;
byBufferDemandMeter : BYTE;
byBufferMaximumDemandMeter : BYTE;
uiBufferOverflowCounter : UINT;
bLineIsBusy : BOOL;
END_VAR
Name | Type | Description |
---|---|---|
bError | BOOL | This output is switched to TRUE as soon as an error occurs during the execution of a command. The command-specific error code is contained in udiErrorId. Only valid if bBusy is FALSE. |
udiErrorId | UDINT | Contains the command-specific error code of the most recently executed command. Only valid if bBusy is FALSE (see error codes). |
bCycleMode | BOOL | Is TRUE if CycleMode is active (see also bSetCycleMode input). |
byBufferDemandMeter | BYTE | Demand of the respective buffer (0 - 100%). |
byBufferMaximumDemandMeter | BYTE | Previous maximum demand of the respective buffer (0 - 100%). |
uiBufferOverflowCounter | UINT | Number of buffer overflows to date. |
bLineIsBusy | BOOL | This output is set as long as the FB_EL6851Communication() block is processing DMX/RDM commands. |