KL6ReadRegisters
The KL6ReadRegisters function block reads one or several registers of a KL6xxx serial Bus Terminal.
Interface
VAR_INPUT
Execute : BOOL;
FirstRegister : UINT;
RegisterCount : UINT;
Mode : ComSerialLineMode_t;
pComIn : POINTER TO ARRAY[0..65] OF BYTE; (* for universal register communication *)
pComOut : POINTER TO ARRAY[0..65] OF BYTE; (* for universal register communication *)
SizeComIn : UINT;
pRegisterList : POINTER TO ARRAY[0..63] OF ComRegisterData_t;
SizeRegisterList : UINT;
END_VAR
VAR_OUTPUT
Done : BOOL;
Busy : BOOL;
Error : BOOL;
ErrorId : ComError_t;
END_VAR
Execute: A rising edge at the Execute input resets the connected serial hardware.
FirstRegister : 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 initialise the register numbers to be read in the register list before the block is triggered. In this case RegisterCount is not used.
RegisterCount : Specifies the number of registers to be read. The 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. (ComSerialLineMode_t).
pComIn: 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: 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: Size of the input process image of the serial hardware being used. The size is determined and assigned with the SIZEOF() function.
pRegisterList : Start adress of a register list of type ComRegisterData_t. The start adress can be determined with ADR(register list).
SizeRegisterList : Size of the register list in bytes. The size can be determined with SIZE(register list). The list may have between 1 and 64 entries.
Done: The Done output becomes TRUE when the function has been carried out without error.
Busy: The Busy output becomes TRUE in response to rising edge at Execute, and remains TRUE for as long as the block is performing its function.
Error: The Error output becomes TRUE as soon as an error occurs.
ErrorID: The ErrorID output provides an error code when an error occurs.