FB_TermRegRead_TcPfw()
A function block of this type is used by FB_TempCtrlCallback_TcPfw for read access to EL terminals.
Syntax
VAR_INPUT
Execute : BOOL;
TermType : E_TcPfw_TerminalType:=eTcPfwTermT_NoTerminal;
Select : INT:=-1;
CycleTime : LREAL:=0.025;
END_VAR
VAR_IN_OUT
Ctrl : USINT;
State : USINT;
InData : INT;
OutData : INT;
END_VAR
VAR_OUTPUT
RegData : WORD:=0;
Busy : BOOL:=FALSE;
Done : BOOL:=FALSE;
CommandAborted: BOOL:=FALSE;
Error : BOOL:=FALSE;
ErrorID : UDINT:=0;
END_VAR
Inputs
Name | Type | Description |
---|---|---|
Execute | BOOL | A rising edge starts the process. |
TermType | E_TcPfw_TerminalType | The coded type of the addressed terminal. |
Select | INT | The register address of the terminal. |
CycleTime | LREAL | The cycle time of the calling task. |
Inputs/outputs
Name | Type | Description |
---|---|---|
Ctrl | USINT | A reference to ST_TcPfw_TempCtrlOutput.KL_SnsCtrl of the terminal. |
State | USINT | A reference to ST_TcPfw_TempCtrlInput.KL_SnsState of the terminal. |
InData | INT | A reference to ST_TcPfw_TempCtrlInput.KL_SnsData of the terminal. |
OutData | INT | A reference to ST_TcPfw_TempCtrlOutput.KL_SnsData of the terminal. |
Outputs
Name | Type | Description |
---|---|---|
RegData | WORD | If successfully executed, the read register content is provided here. |
Busy | BOOL | The ongoing activity of the function block is signaled here. |
Done | BOOL | The successful completion of the operation is reported here. |
CommandAborted | BOOL | A TRUE indicates here that the process was aborted. |
Error | BOOL | A TRUE indicates here the occurrence of a problem. |
ErrorID | UDINT | In the event of an error, coded information is provided here. |
Behavior of the function block:
A rising edge at Execute causes the function block to perform a series of checks:
- Select must be in the range 0 to 63 (inclusive).
- No other register communication must be active with this terminal.
- TermType must identify a KL terminal. Only these support the communication mechanism used here.
If one of the above conditions is not met, an error is reported. Otherwise, the access is transmitted to the terminal. The result of the transmission is provided at the outputs.
In addition to the above-mentioned error possibilities, problems can occur during transmission. Furthermore, the terminal can report a problem (addressing, values, access type). |
A register access requires that all elements with name beginning with "KL_" in ST_TcPfw_TempCtrlInput are linked. |