KL6Configuration
The KL6configuration function block initialises and configures a KL6xxx Serial Bus Terminal.
In Version 2.0 and above of the library the function block replaces the hardware-dependent KL6Config and KL6Config5B function blocks.
Note: The function block uses register communication to configure KL6 terminals. Register communication is not available with EtherCAT terminals. EL terminal can be configured with function blocks (FB_EcCoeSdoWrite) from the TwincAT EtherCAT library.
Interface
VAR_INPUT
Execute : BOOL;
Mode : ComSerialLineMode_t;
Baudrate : UDINT; (* 115200, 57600, 38400, 19200, 9600, 4800, 2400, 1200 *)
NoDatabits : BYTE; (* 7 or 8 *)
Parity : ComParity_t; (* PARITY_NONE=0, PARITY_EVEN=1, PARITY_ODD=2 *)
Stopbits : BYTE; (* 1 or 2 *)
Handshake : ComHandshake_t; (* HANDSHAKE_NONE=0, HANDSHAKE_RTSCTS=1, HANDSHAKE_XONXOFF=2 *)
ContinousMode : BOOL; (* don't start transmission before transmit buffer is filled *)
pComIn : POINTER TO BYTE; (* for universal register communication *)
pComOut : POINTER TO BYTE; (* for universal register communication *)
SizeComIn : 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.
Mode: The Mode input specifies unambiguously which serial hardware is being used. (ComSerialLineMode_t).
Baudrate: The baud rate, provided it is supported by the serial hardware.
NoDatabits: The number of user data bits in one data byte.
Parity: The type of the parity bit in a data byte.
Stopbits: The number of stop bits per data byte.
Handshake: The type of handshake used, provided it is supported by the serial hardware.
ContinousMode: Switches on continuous transmission, provided this is supported by the serial hardware.
If ContinousMode is TRUE, transmitted data is not sent out by the serial hardware until the hardware transmit buffer is full. This means that there are no time gaps in the transmission, provided the quantity of data is similar in size to the hardware transmit buffer. Continuous mode is only necessary in special cases in which the end device reacts to time gaps with a time-out.
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.
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.