FB_SMIDiagAll

FB_SMIDiagAll 1:

Using this command it is possible to determine the direction in which the drives are driving, whether they have stopped or whether there is a motor error. The command can also be sent also to several SMI slaves. The states of all SMI slaves can thus be queried with a single command.

The result of the query is forwarded by four outputs. Each of these outputs can assume three states:

Some examples of this are explained further below.

VAR_INPUT

bStart            : BOOL;
dwAddr            : DWORD := 0;
eAddrType         : E_SMIAddrType := eSMIAddrTypeAddress;
dwAddrOption      : DWORD := 0;
eCommandPriority  : E_SMICommandPriority := eSMICommandPriorityMiddle;

bStart: the function block is started and the command is sent on applying a positive edge to 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 or for group addressing. Addressing by slave Id (eAddrType = eSMIAddrTypeSlaveId) is not permitted.

dwAddrOption: Reserved for future expansions.

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

VAR_OUTPUT

bBusy           : BOOL;
bError          : BOOL;
udiErrorId      : UDINT;
eResDrivesUp    : E_SMIDiagResDrivesUp;
eResDrivesDown  : E_SMIDiagResDrivesDown;
eResIsStopped   : E_SMIDiagResIsStopped;
eResWithError   : E_SMIDiagResWithError;

bBusy: when the 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 again set 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.

eResDrivesUp: at least one motor is driving up / no motor is driving up / the value is undefined.

eResDrivesDown: at least one motor is driving down / no motor is driving down / the value is undefined.

eResIsStopped: at least one motor has stopped / no motor has stopped / the value is undefined.

eResWithError: at least one motor is in an error state / no motor is in an error state / the value is undefined.

VAR_IN_OUT

stCommandBuffer   : ST_SMICommandBuffer;

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

Examples

All drives have stopped:

Outputs

Meaning

eResDrivesUp = eSMIDiagResNoMotorDrivesUp

No drive is driving up.

eResDrivesDown = eSMIDiagResNoMotorDrivesDown

No drive is driving down.

eResIsStopped = eSMIDiagResAtLeastOneMotorIsStopped

At least one drive has stopped.

eResWithError = eSMIDiagResNoMotorWithError

No drive has a motor error.

All drives are driving up:

Outputs

Meaning

eResDrivesUp = eSMIDiagResAtLeastOneMotorDrivesUp

At least one drive is driving up.

eResDrivesDown = eSMIDiagResNoMotorDrivesDown

No drive is driving down.

eResIsStopped = eSMIDiagResNoMotorIsStopped

No drive has stopped.

eResWithError = eSMIDiagResNoMotorWithError

No drive has a motor error.

One drive has stopped and one drive is driving up:

Outputs

Meaning

eResDrivesUp = eSMIDiagResAtLeastOneMotorDrivesUp

At least one drive is driving up.

eResDrivesDown = eSMIDiagResNoMotorDrivesDown

No drive is driving down.

eResIsStopped = eSMIDiagResAtLeastOneMotorIsStopped

At least one drive has stopped.

eResWithError = eSMIDiagResNoMotorWithError

No drive has a motor error.

One drive has stopped, one drive is driving up and one drive is driving down:

Outputs

Meaning

eResDrivesUp = eSMIDiagResAtLeastOneMotorDrivesUp

At least one drive is driving up.

eResDrivesDown = eSMIDiagResAtLeastOneMotorDrivesDown

At least one drive is driving down.

eResIsStopped = eSMIDiagResAtLeastOneMotorIsStopped

At least one drive has stopped.

eResWithError = eSMIDiagResNoMotorWithError

No drive has a motor error.

Requirements

Development environment

Target system

Required libraries

TwinCAT 2.11 R3/x64 from build 2238

PC/CX, BX or BC

TcSMI library from V1.0.0