Reconfigure (FB)

FUNCTION_BLOCK Reconfigure EXTENDS CBM.ETrig

This function block reads and applies the whole configuration of the corresponding device and all subdevices. After Reconfiguring all changed configuration values (Enable flag, Parameter changes, …) take effect. If device doesn’t support reconfiguring eError returns ERROR.NOT_SUPPORTED.

Example

Following example code disables a slave device beneath a fieldbus master.

 PROGRAM PLC_PRG
 VAR
     iState : INT := 0;
     reconfig : DED.Reconfigure;
 END_VAR

 CASE iState OF

    0: //Disable slave device: Slave1 (= name in device tree)
       Slave1.Enable := FALSE;
       iState := 1;

    1: //start reconfiguring of fieldbus master
       reconfig(xExecute := TRUE, itfNode := Master);
       IF reconfig.xDone THEN
           iState := 3;
       ELSIF reconfig.xError THEN
           iState := 2;
       END_IF

    2: //reconfiguring error
       //TODO: Add code here
       reconfig(xExecute := FALSE);

    3: //reconfiguring successful ==> slave disabled
       //TODO: Add code here
       reconfig(xExecute := FALSE);

END_CASE
Note

This feature may not be supported by all fieldbus drivers. eError will return ERROR.NOT_SUPPORTED if not supported.

InOut:

Scope

Name

Type

Comment

Inherited from

Input

xExecute

BOOL

Rising edge: Action starts

Falling edge: Resets outputs

If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values (xDone, xError) are present at the outputs for exactly one cycle.

ETrig

Output

xDone

BOOL

TRUE: Action successfully completed

ETrig

xBusy

BOOL

TRUE: Function block active

ETrig

xError

BOOL

TRUE: Error occurred, function block aborts action

FALSE: No error

ETrig

Input

itfNode

INode

The node to be reconfigured.

Output

eError

ERROR

operation error code