FB_SMISendSMICommand

FB_SMISendSMICommand 1:

This function block is for the general sending of an SMI command. The precise structure of an SMI command and the functioning of the KL6831/KL6841 must be known for this. The use of this function block is necessary only if an SMI command is to be sent that is not covered by the other PLC function blocks.

VAR_INPUT

bStart                  : BOOL;
dwAddr                  : DWORD := 0;
eAddrType               : E_SMIAddrType := eSMIAddrTypeAddress;
dwAddrOption            : DWORD := 0;
eCommandPriority        : E_SMICommandPriority := eSMICommandPriorityMiddle;
eCommandType            : E_SMICommandType := eSMICommandTypeWrite;
eResponseFormat         : E_SMIResponseFormat := eSMIResponseFormatDiagnosis;
arrIdentificationBytes  : ARRAY [0..2] OF BYTE;
arrParameters           : ARRAY [0..2] OF DWORD;
bSuppressResponseBuffer : BOOL := FALSE;
dwOptions               : DWORD := 0;

bStart: The function block is activated by a positive edge at this input.

dwAddr: manufacturer code (0-15), address of a device (0-15), bit field (16 bits) for the group addressing or slave ID (32-bit key ID). This input has no meaning if a collective call (broadcast) is sent.

eAddrType: defines whether the dwAddr input is to be evaluated as a manufacturer code, the address of a device (see E_SMIAddrType), for group addressing or as a slave ID.

dwAddrOption: if the SMI device is addressed by slave ID (eAddrType = eSMIAddrTypeSlaveId), then the manufacturer code must be specified via this input.

eCommandPriority: priority (high, medium or low) with which the command is processed by the PLC library (see E_SMICommandPriority).

eCommandType: Command type: Write/Read (see E_SMICommandType). This parameter affects bit 5 of the start byte of the SMI telegram.

eResponseFormat: ResponseFormat: Special diagnostic formats/standard (see E_SMIResponseFormat). This parameter affects bit 6 of the start byte of the SMI telegram.

arrIdentificationBytes: an SMI telegram can consist of up to 3 blocks. Each block possesses an identifier byte. Each block possesses an identifier byte.

arrParameters: an SMI telegram can consist of up to 3 blocks. Each block possesses up to four value bytes. The value bytes of the individual blocks are defined by this array.

bSuppressResponseBuffer: if this input is set to TRUE the internal software buffer is not filled with the responses from the FB_KL6831KL6841Communication() block.

dwOptions: reserved for future expansions.

VAR_OUTPUT

bBusy                        : BOOL;
bError                       : BOOL;
udiErrorId                   : UDINT;
arrResponseData              : ARRAY [0..7] OF BYTE;
byResponseDataLength         : BYTE;
byResponseIdentificationByte : BYTE;

bBusy: When the function block is activated the output is set, and it remains active until execution of the command has been completed.

bError: This output is switched to TRUE as soon as an error occurs during the execution of a command. The command-specific error code is contained in udiErrorId. The output is set back to FALSE by the reactivation of the function block via the bStart input.

udiErrorId: Contains the command-specific error code of the most recently executed command. It is set back to 0 by the reactivation of the function block via the bStart input (see error codes).

arrResponseData: the data received from the SMI devices.

byResponseDataLength: the length of the data received in bytes.

byResponseIdentificationByte: the identifier byte received.

VAR_IN_OUT

stCommandBuffer : ST_SMICommandBuffer; 

stCommandBuffer: reference to the structure for communication (buffer) with the FB_KL6831KL6841Communication() function block (see ST_SMICommandBuffer).

Prerequisites

Development environment

required TC3 PLC library

TwinCAT from v3.1.4020.14

Tc2_SMI from 3.3.5.0