FB_KL320xConfig
The FB_KL320xConfig function block is used to parameterize a KL3201, KL3202 or KL3204: input terminal for resistance sensors.
The function block only parameterizes one terminal channel. For parameterizing all channels, the corresponding number of function blocks has to be instantiated. A mixed configuration (e.g. different sensor types) is possible. |
Inputs
VAR_INPUT
bConfigurate : BOOL;
bReadConfig : BOOL;
iSetSensorType : INT;
tTimeout : TIME;
END_VAR
Name | Type | Description |
---|---|---|
bConfigurate | BOOL | A rising edge starts the configuration sequence. First, the general terminal data, i.e. "terminal name", "special version" and "firmware version", are read. Then, the specified settings are written to the corresponding registers and finally read again for verification and information. The read information is displayed at the function block outputs. During this sequence the output bBusy is TRUE, and no further command, e.g. bReadConfig, is accepted. |
bReadConfig | BOOL | A rising edge starts a read sequence. The general terminal data “terminal name”, “special version” and “firmware version” are read, followed by the set configuration parameters. The read information is displayed at the function block outputs. During the read sequence the output bBusy is TRUE, and no further command, e.g. bConfigurate, is accepted. |
iSetSensorType | INT | This input is used to set the sensor. The setting is based on the table below. |
tTimeout | TIME | The terminal configuration or reading of the configuration must be completed within the time entered here. Otherwise an error with a corresponding error number is issued at the outputs bError and iErrorId. |
iSetSensorType | Element |
---|---|
0 | PT100 |
1 | NI100 |
2 | PT1000 |
3 | PT500 |
4 | PT200 |
5 | NI1000 |
6 | NI120 |
7 | Output 10.0 Ω – 5000.0 Ω |
8 | Output 10.0 Ω – 1200.0 Ω |
9 | PT1000 - two-wire connection - not permitted when using a KL3204! |
Inputs/outputs
VAR_IN_OUT
stInData : ST_KL1501InData;
stOutData : ST_KL1501OutData;
END_VAR
Name | Type | Description |
---|---|---|
stInData | Reference to the structure of the input process image. | |
stOutData | Reference to the structure of the output process image. |
Outputs
VAR_OUTPUT
bBusy : BOOL;
bError : BOOL;
iErrorId : UDINT;
iState : USINT;
iDataIn : INT;
iTerminalType : WORD;
iSpecialType : WORD;
iFirmwareVersion : WORD;
sDescription : STRING;
sSensorType : STRING;
bTwoWiredConnection : BOOL;
END_VAR
Name | Type | Description |
---|---|---|
bBusy | BOOL | As long as the read or configuration sequence is in progress, this output is TRUE. |
bError | BOOL | This output is switched to TRUE, if an error occurred while a command (Configure or Read) is executed. The command-specific error code is contained in iErrorId. |
iErrorId | UDINT | Contains the command-specific error code of the most recently executed command. It is reset to 0 by activating the function block again via the inputs bConfigurate or bReadConfig. See error codes. |
iState | USINT | Corresponds to the status variable of the process data stInData.iState, see VAR_IN_OUT. During command execution (bBusy = TRUE) this output is set to 0. This output is therefore suitable for assessing the status of the terminal in normal operation. Interfering states during configuration and reading through the register communication are hidden. |
iDataIn | UDINT | Corresponds to the data variable of the process data stInData.iDataIn, see VAR_IN_OUT. During command execution (bBusy = TRUE) this output retains the value it had before the command was called. This makes the output suitable for direct process data processing during normal operation of the terminal. Interfering states during configuration and reading through the register communication are hidden. |
iTerminalType | WORD | Contents of register 8 (terminal name). When used with the correct terminal, the content should be 0x05DD (1501dec). |
iSpecialType | WORD | Contents of register 29 (special version) |
iFirmwareVersion | WORD | Contents of register 9 (firmware version) |
sDescription | STRING | Terminal name, special version and firmware version as string (e.g. 'terminal KL1501-0000 / firmware 1C'). |
sSensorType | STRING | Set sensor type in plain text. |
bTwoWiredConnection | BOOL | Sensor type is parameterized in the 2-wire connection. |
Requirements
Development environment | Target platform | IO Hardware | PLC libraries to include |
---|---|---|---|
TwinCAT v3.1.4018.26 | PC/CX | KL3201, KL3202, KL3204 | Tc2_IoFunctions from v3.3.5.0 |