FB_SMISendSMICommand
The function block FB_SMISendSMICommand is used 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.
Inputs
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;
END_VAR
Name | Type | Description |
---|---|---|
bStart | BOOL | The function block is activated by a positive edge at this input. |
dwAddr | DWORD | Manufacturer code (0-15), address of a device (0-15), bit field (16 bits) for group addressing or slave ID (32-bit key ID). This input has no meaning if a broadcast is sent. |
eAddrType | Defines whether the input dwAddr is to be evaluated as a manufacturer code, the address of a device, for group addressing or as a slave ID. | |
dwAddrOption | DWORD | 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. | |
eCommandType | Command type: Write/Read. This parameter affects bit 5 of the start byte of the SMI telegram. | |
eResponseFormat | Response format: diagnostic special format/standard. This parameter affects bit 6 of the start byte of the SMI telegram. | |
arrIdentificationBytes | ARRAY OF BYTE | An SMI telegram can consist of up to 3 blocks. Each block possesses an identification byte. This array defines the three identification bytes. |
arrParameters | ARRAY OF DWORD | An SMI telegram can consist of up to 3 blocks. Each block has up to four value bytes. This array defines the value bytes of each block. |
bSuppressResponseBuffer | BOOL | If this input is set to TRUE, the internal software buffer is not filled with the responses of the function block FB_KL6831KL6841Communication(). |
dwOptions | DWORD | Reserved for future extensions |
Inputs/outputs
VAR_IN_OUT
stCommandBuffer : ST_SMICommandBuffer;
END_VAR
Name | Type | Description |
---|---|---|
stCommandBuffer | Reference to the structure for communication (buffer) with the function block FB_KL6831KL6841Communication() |
Outputs
VAR_OUTPUT
bBusy : BOOL;
bError : BOOL;
udiErrorId : UDINT;
arrResponseData : ARRAY [0..7] OF BYTE;
byResponseDataLength : BYTE;
byResponseIdentificationByte : BYTE;
END_VAR
Name | Type | Description |
---|---|---|
bBusy | BOOL | This output is set as soon as the function block processes a command and remains active until the command has been processed. |
bError | BOOL | 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 reset to FALSE by the reactivation of the function block via the input bStart. |
udiErrorId | UDINT | Contains the command-specific error code of the most recently executed command. It is reset to 0 by the reactivation of the function block via the input bStart (see error codes). |
arrResponseData | ARRAY OF BYTE | The data received from the SMI devices |
byResponseDataLength | BYTE | The length of the data received in bytes |
byResponseIdentificationByte | BYTE | The received identification byte |
Requirements
Development Environment | PLC library to include |
---|---|
TwinCAT from v3.1.4020.14 | Tc2_SMI from 3.3.5.0 |