FB_LON_KL6401

FB_LON_KL6401 1:

This function block is used for sending / receiving LON SNVTs via Bus Terminal KL6401. An instance of this block is required for each terminal. One instance can send or receive up to 62 SNVTs.

The FB must be tied to the send/receive blocks via the VAR_IN_OUT structure stLON_Com stLON_Com.

FB_LON_KL6401 2:

Restrictions

  • Only one call per instance
  • Call must be made once per PLC cycle
  • Instance must be called in the same PLC task as the send and receive blocks assigned to it

FB_LON_KL6401 3: Inputs

VAR_INPUT
  bResetMaxBuffer : BOOL;
  bDisabled       : BOOL := FALSE;;
END_VAR

Name

Type

Description

bResetMaxBuffer

BOOL

Deletes the value rMaxBuffer for the maximum utilization of the transmit buffer.

bDisabled

BOOL

TRUE = deselection of the function block.

FB_LON_KL6401 4: Inputs/outputs

VAR_IN_OUT
  stParameter_IN         : ST_LON_Parameter_IN_36B;
  stParameter_OUT        : ST_LON_Parameter_OUT_36B;
  stLON_Com              : ST_LON_Communication;
END_VAR

Name

Type

Description

stParameter_IN

ST_LON_Parameter_IN_36B

Input variable of the hardware.

stParameter_OUT

ST_LON_Parameter_OUT_36B

Output variable of the hardware.

stLON_Com

ST_LON_Communication

This structure is used to link the function block with the send/receive blocks. The actual sending and receiving is realized in this function block. The transmit/receive blocks only deal with preparation/evaluation of the data.

FB_LON_KL6401 5: Outputs

VAR_OUTPUT
  bReady      : BOOL;
  bBusy       : BOOL;
  bTimeOut    : BOOL;
  bError      : BOOL;
  eError      : E_LON_ERROR;
  dwErrorKL   : DWORD;
  byLONState  : BYTE;
  stKL6401    : ST_KL6401;
  arrNeuronID : ARRAY [0..5] OF BYTE;
  arrProgID   : ARRAY [0..7] OF BYTE;
  wFW         : WORD;
  byActBuffer : BYTE;
  rActBuffer  : REAL;
  rMaxBuffer  : REAL;
END_VAR

Name

Type

Description

bReady

BOOL

The initialization is complete.

bBusy

BOOL

The output is TRUE as long as values are sent.

bTimeOut

BOOL

Timeout during initialization.

bError

BOOL

This output goes TRUE as soon as an error occurs. This error is described via the eError variable.

eError

E_LON_ERROR

In the event of an error, the output issues an error code and bError becomes TRUE at the same time.

dwErrorKL

DWORD

Error ID of the function block. In this case the variable eError has the value "eKL6401_Error". bError goes TRUE at the same time.

byLONState

BYTE

LON state.

stKL6401

ST_KL6401

Structure for the configuration (for future applications).

arrNeuronID

ARRAY OF BYTE

Neuron ID of the terminal (supported since firmware 4C).

arrProgID

ARRAY OF BYTE

Program ID of the terminal (supported since firmware 4C).

wFW

WORD

Terminal firmware (supported since firmware 4C).

byActBuffer

BYTE

Number of instructions in the transmit buffer.

rActBuffer

REAL

Current utilization of the transmit buffer in percent.

rMaxBuffer

REAL

Maximum utilization of the transmit buffer in percent. The value can be reset with the input variable bResetMaxBuffer.

Requirements

Development Environment

TwinCAT 3 PLC library to be integrated

TwinCAT from v3.1.4020.14

Tc2_LON from 3.3.4.0