KL6ReadRegisters

The function block KL6ReadRegisters reads one or several registers of a serial Bus Terminal KL6xxx.
Inputs
VAR_INPUT
Execute : BOOL;
FirstRegister : UINT;
RegisterCount : UINT;
Mode : ComSerialLineMode_t;
pComIn : POINTER TO BYTE;
pComOut : POINTER TO BYTE;
SizeComIn : UINT;
pRegisterList : POINTER TO ARRAY[0..63] OF ComRegisterData_t;
SizeRegisterList : UINT;
END_VARName | Type | Description |
|---|---|---|
Execute | BOOL | A rising edge at the Execute input starts the read process. |
FirstRegister | UINT | Specifies the first register to be read. From this register number (which may range between 1 and 64), RegisterCount data are read and stored in the register list of type ComRegisterData_t. If no coherent register range is to be read, the value 16#FFFF can be stored in FirstRegister. In this case the user has to initialize the register numbers to be read in the register list before the function block is triggered. In this case RegisterCount is not used. |
RegisterCount | UINT | Specifies the number of registers to be read. The function block reads a coherent register range from FirstRegister and stores the data in the register list. |
Mode | The Mode input specifies unambiguously which serial hardware is being used. | |
pComIn | POINTER TO BYTE | Universal pointer to the input variable of the process data for the serial hardware (data types: KL6inData, KL6inData5b, KL6inData22b, PcComInData). The pointer is assigned with the ADR() function. |
pComOut | POINTER TO BYTE | Universal pointer to the output variable of the process data for the serial hardware (data types: KL6outData, KL6outData5b, KL6outData22b, PcComOutData). The pointer is assigned with the ADR() function. |
SizeComIn | UINT | Size of the input process image of the serial hardware being used. The size is determined and assigned with the SIZEOF() function. |
pRegisterList | POINTER TO ARRAY[0..63] OF ComRegisterData_t | Start address of a register list. The start address can be determined with ADR(register list). |
SizeRegisterList | UINT | Size of the register list in bytes. The size can be determined via SIZEOF (register list). The list may have between 1 and 64 entries. |
Outputs
VAR_OUTPUT
Done : BOOL;
Busy : BOOL;
Error : BOOL;
ErrorID : ComError_t;
END_VARName | Type | Description |
|---|---|---|
Done | BOOL | The Done output becomes TRUE when the function has been carried out without error. |
Busy | BOOL | The Busy output becomes TRUE in response to rising edge at Execute, and remains TRUE for as long as the function block is performing its function. |
Error | BOOL | This output Error goes TRUE as soon as an error occurs. |
ErrorID | The ErrorID output provides an error code when an error occurs. |
Requirements
Development environment | Target platform | PLC libraries to include |
|---|---|---|
TwinCAT v3.1.4012 | PC or CX (x86, x64, Arm®) | Tc2_SerialCom |