FB_KL27x1Config
Function block to parameterize a KL2751 or a KL2761: 1-channel dimming-terminal.
VAR_INPUT
bConfigurate : BOOL;
bReadConfig : BOOL;
iSetSensorType : INT;
bSetDimRampAbsolute : BOOL;
iSetRampTime : INT;
bSetWatchdogDisable : BOOL;
iSetWatchdogTimeout : UINT;
iSetTimeoutOnValue : UINT;
iSetTimeoutOffValue : UINT;
iSetDimmerMode : INT;
bSetOnAfterShortCircuit : BOOL;
bSetLineFrequency60Hz : BOOL;
tTimeout : TIME;
bConfigurate: A rising edge at this input starts a configuration-sequence. At first the common terminal data like "terminal type", "special type" and "firmware version" will be read. Afterwards the internal registers will be set according to the configurations at the inputs of this function-block. To make sure, the configuration has been successful, the registers will be read and the information will be shown at the outputs of the FB, together with the common terminal-data. As long as this sequence is running, the output bBusy is set to TRUE and no other command, like bReadConfig, will be executed.
bReadConfig: A rising edge at this input starts the reading-sequence only. The common terminal data like "terminal type", "special type" and "firmware version" will be read together with the internal configuration-parameters. The read information will be shown at the FB-outputs afterwards. As long as this sequence is running, the output bBusy is set to TRUE and no other command, like bConfigurate, will be executed.
bSetDimRampAbsolute: FALSE: the entered ramp-time iSetRampTime refers to the whole process-data-range (0 - 32767). Smaller jumps will take less time. TRUE: each jump, regardless of size, will take the same time: iSetRampTime.
iSetRampTime: Entry of the ramp-time with discrete values as listed in the table below.
bSetWatchdogDisable: The internal watchdog will be disabled.
iSetWatchdogTimeout: Setting the watchdog-time in multiples of 10ms.
iSetTimeoutOnValue: This entry specifies the light value that is issued for a fieldbus error and current process data > 0.
iSetTimeoutOffValue: This entry specifies the light value that is issued for a fieldbus error and current process data = 0.
iSetDimmerMode: At this input, the dimmer mode is to be set according to the table below.
bSetOnAfterShortCircuit: Behavior after a shortcut. FALSE: The light remains switched off. TRUE: The light will be turned on again.
bSetLineFrequency60Hz: This entry specifies the line frequency. FALSE: 50 Hz. TRUE: 60 Hz.
tTimeout: The commands bConfigurate and bReadConfig have to be successfully executed within this time.
iSetRampTime | Element |
---|---|
0 | 50 ms |
1 | 100 ms |
2 | 200 ms |
3 | 500 ms |
4 | 1 s |
5 | 2 s |
6 | 5 s |
7 | 10 s |
iSetDimmerMode | Element |
0 | Automatic detection |
1 | Trailing edge control |
2 | Leading edge control |
3 | Rectifier mode, positive (positive half-wave with leading edge control) |
4 | Rectifier mode, negative (positive half-wave with leading edge control) |
VAR_OUTPUT
bBusy : BOOL;
bError : BOOL;
iErrorId : UDINT;
iState : USINT;
iDataIn : INT;
iTerminalType : WORD;
iSpecialType : WORD;
iFirmwareVersion : WORD;
sDescription : STRING;
sSensorType : STRING;
bBusy: If a reading- or configuration-sequence is being processed, this output will be set to TRUE.
bError: 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.
iErrorId: Contains the command-specific error code of the most recently executed command. It is set back to 0 by the reactivation of the function block via the bConfigurate or the bReadConfig input. See Error codes.
iState: This value corresponds to the state-variable of the process-data stInData.iState, see VAR_IN_OUT. During command-execution (bBusy = TRUE) this output is set to 0 and remains unchanged. It is thus suitable to evaluate the state of the terminal under normal conditions: disturbing values during configuration and reading due to register-communication will not be shown.
iDataIn: This value corresponds to the process data stInData.iDataIn, see VAR_IN_OUT. During command-execution (bBusy = TRUE) this output is set to the value previous to the execution and remains unchanged. It is thus suitable for direct process control: disturbing values during configuration and reading due to register-communication will not be shown.
iTerminalType: Contents of register 8. If the right terminal is selected, this value should be either 0x0ABF (2751dec) or 0x0AC9 (2761dec).
iSpecialType: Contents of register 29: special-type.
iFirmwareVersion: Contents of register 9: firmware-version.
sDescription: Terminal-type, special-version and firmware-version put together to a readable string (e.g. 'Terminal KL27x1-0000 / Firmware 1C').
bDimRampAbsolute: TRUE: Dim ramp is set to absolute: every step, regardless of size will take the same time, which is entered under iSetRampTime.
sRampTime: Entered ramp-time.
bWatchdogDisable: TRUE: Watchdog is disabled.
tWatchdogTimeout: Entered watchdog-time.
iTimeoutOnValue: Entered light value that is issued for a fieldbus error and current process data > 0.
iTimeoutOffValue: Entered light value that is issued for a fieldbus error and current process data = 0.
sDimmerMode: Entered dimmer mode as readable text.
sAfterShortCircuit: Entered behavior after shortcut.
sLineFrequency: Entered line-frequency.
VAR_IN_OUT
stInData : ST_KL27x1InData;
stOutData : ST_KL27x1OutData;
stInData: Reference to the structure containing the input process image.
stOutData: Reference to the structure containing the output process image.
Background information
On ARM systems, the structure as a whole cannot be linked to the image of the terminal - the structure variables must be linked individually.
In addition, a new DWORD key must be created in the Windows registry of the development computer, otherwise memory image shifts will occur.
Under "HKEY_CURRENT_USER\Software\Beckhoff\TwinCAT System Manager\On Startup" the key "SubVarOffsByOffs" with the value "1" is inserted.
Afterwards restart the development computer once.
Requirements
Development Environment | Target System | IO Hardware | PLC Libraries to include |
---|---|---|---|
TwinCAT v2.11 R3/x64 from Build 2254 | PC/CX | KL2751, KL2761 | TcIoFunctions.Lib ( Standard.Lib; TcBase.Lib; TcSystem.Lib; TcUtilities.Lib are included automatically ) |
TwinCAT v2.11 R3/x64 from Build 2256 | BC | KL2751, KL2761 | TcIoFunctions.lb6 ( Standard.lb6 will be included automatically ) |
TwinCAT v2.11 R3/x64 from Build 2256 | BX | KL2751, KL2761 | TcIoFunctions.lbx ( Standard.lbx will be included automatically ) |