FB_SMIAddressing

FB_SMIAddressing 1:

This function block addresses the connected SMI devices according to the random principle. The user has no influence over which address is assigned to which SMI device. The addresses are assigned in descending order, starting with the address specified by the byHighestAddress parameter.

Applying a positive edge to the bStart input starts the block, and the bBusy output goes TRUE. The function block now independently addresses all SMI devices. The output variable arrAddressedDevices provides information which SMI devices have already received an address. Once all SMI devices have been addressed, the bBusy output goes FALSE again. Addressing can be aborted through a positive edge at input bCancel. Processing this function block can take several minutes, depending on how many SMI devices are connected.

VAR_INPUT

bStart           : BOOL;
bCancel          : BOOL;
byHighestAddress : BYTE := 15;
dwOptions        : DWORD := 0;

bStart: the function block is started and the command is sent on applying a positive edge to this input.

bCancel: the function block is deactivated and the search is aborted on applying a positive edge to this input.

byHighestAddress: address from which the SMI devices are addressed in descending order (0-15).

dwOptions: reserved for future extensions.

VAR_OUTPUT

bBusy                    : BOOL;
bError                   : BOOL;
udiErrorId               : UDINT;
dwCurrentSearchSlaveId   : DWORD;
byCurrentManufacturer    : BYTE;
byCurrentSlaveAddr       : BYTE;
arrAddressedDevices      : ARRAY [0..15] OF BOOL;

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.

dwCurrentSearchSlaveId: current slave ID used in the search algorithm.

byCurrentManufacturer: current manufacturer code used in the search algorithm.

byCurrentSlaveAddr: current address used in the search algorithm. As long as the value is greater than byHighestAddress, still no SMI device was addressed.

arrAddressedDevices: if an address is assigned to an SMI device, then the corresponding element in the array is set to TRUE.

VAR_IN_OUT

stCommandBuffer      : ST_SMICommandBuffer;

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

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