FB_RegisterComKL25xx

FB_RegisterComKL25xx 1:

The function block FB_RegisterComKL25xx is used for register communication between PLC and the terminals KL2502, KL2521, KL2531, KL2541 and KL5001.

The function block before reading or writing from or into the register reads the AxisID, EncoderID, DriveID to which the terminal variables are mapped. Further the function block cancels or cuts the link between drive o/p and terminal so as inhibit the NC task access. Hence there is no communication between the drive output and terminal during the execution of this function block. This is then followed by register read or write. The NC task access is restored once the register communication is done (Drive ouput is activated).

Requirements:

It is necessary to map the terminal process data variables to the encoder and drive variables of the corresponding axis by selecting appropriate encoder and drive type. Based on mapping between IO terminals and NC variables, the terminals can be classified into two groups as KL2531 and KL2541 into one group and the other group consisting of the terminals KL2502 and KL2521.

The mapping between terminal and NC variables that is required for successful execution of this function block can be shown as under

FB_RegisterComKL25xx 2:

Note :

If a register communication cycle has been initiated by a rising edge on both Read and Write inputs, the function block first writes the given RegisterValue in the specified RegisterNumber and then reads the register value from the same RegisterNumber again. This situation is not considered as an error.

The register read and write is done from and to the EEPROM respectively. In case of writing into a register there is an exception that one cannot write into Manufacturer registers using this function block. This would lead to an error number 0x4B41.

VAR_INPUT

VAR_INPUT
    Read            : BOOL;  (* Indication to read a register *)
    Write           : BOOL;  (* Indication to write into a register *)
    RegisterNumber  : USINT; (* Register number to be communicated with *)
    RegisterValue   : UINT;  (* Register Value to be written, provided Write = TRUE *)
END_VAR

Read : The read command is executed with rising edge on this input.

Write : The write command is executed with rising edge on this input.

RegisterNumber : The register number to be read/written is specified in this variable.

RegisterValue : In case the input Write is TRUE then this variable specifies the register value to be written. In case the input Read is TRUE, the value in this variable is not considered.

VAR_OUTPUT

VAR_OUTPUT
    Done                   : BOOL;  (* move completed *)
    Busy                   : BOOL;  (* function block is currently busy *)
    Error                  : BOOL;  (* Signals that an error has occurred within Function Block *)
    ErrorID                : UDINT; (* Error identification *)
    TerminalType           : UINT;  (* Terminal type/number involved in register communication *)
    CurrentRegisterNumber  : USINT; (* Register Number that was under process *)
    CurrentRegisterValue   : UINT;  (* Register Value of the register under process *)
END_VAR

Done : Becomes TRUE, if a register communication has been successfully completed. The register number read/written is specified in CurrentRegisterNumber and the corresponding value in CurrentRegisterValue.

Busy: Becomes TRUE as soon as the function block is active, and becomes FALSE when it has returned to its initial state.

Error : Becomes TRUE, as soon as an error occurs.

ErrorID : If the error output is set, this parameter supplies the error number.

TerminalType : When Done is TRUE this output holds the terminal type/number involved in register communication.

CurrentRegisterNumber : When Done is TRUE this output gives the register number that was under process.

CurrentRegisterValue : When Done is TRUE this output gives the register value of the register under process.

VAR_IN_OUT

VAR_IN_OUT
    AxisRefIn   : NCTOPLC_AXLESTRUCT;
    AxisRefOut  : PLCTONC_AXLESTRUCT;
END_VAR

AxisRefIn : Axis structure from NC.

AxisRefOut : Axis structure from PLC.

 

Requirements

Development environment

Target system type

PLC libraries to be linked

from TwinCAT v2.10 Build 1314

PC (i386)

TcNc.Lib