Reconfigure ¶ A reconfiguration can be used to apply new configuration values to a device and all subdevices. After reconfiguring all changed configuration values (Enable flag, Parameter changes, …) take effect. Reconfigure (FunctionBlock)
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 ; ELSE IF 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 Input itfNode INode The node to be reconfigured. Output eError ERROR operation error code
Stack ¶ Function blocks working on IStack nodes. GetBusScan (FunctionBlock)
GetBusScan (FB) ¶ FUNCTION_BLOCK GetBusScan EXTENDS CBM.ETrigA Function block for triggering a bus scan. 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 Input itfNode INode IStack node performing the bus scan. Output eError ERROR operation error code itfFirstDevice INode The first scanned device
Utility ¶ GetIDeviceInstByIoAddr (FunctionBlock)
GetIDeviceInstByIoAddr (FB) ¶ FUNCTION_BLOCK GetIDeviceInstByIoAddr EXTENDS CBM.ETrigA IMPLEMENTS ICmpEventCallback This function block returns the associated IDevice object for a specific I/O address. InOut: Scope Name Type Comment Input dwAddress DWORD Address of the I/O Channel (e.g. ADR(%QB0) ) dwBitOffset DWORD Bit Offset starting at 0; must be set for bitchannels Output itfDevice IDevice IDevice instance of the device, the I/O channel belongs to.
Functions ¶ CanReconfigure (Function) GetNextNode (Function) GetNodeDepth (Function) GetRoot (Function) INode_TO_IBus (Function) INode_TO_IDevice (Function) INode_TO_IDevice2 (Function) INode_TO_IStack (Function)
CanReconfigure (FUN) ¶ FUNCTION CanReconfigure : BOOL The function returns TRUE if itfNode can perform a Reconfigure-Action. Only nodes implementing IReconfigureProvider can be used as input of Reconfigure InOut: Scope Name Type Return CanReconfigure BOOL Input itfNode INode
GetNextNode (FUN) ¶ FUNCTION GetNextNode : INode The function implements a depth-first search. Nodes will be returned in top to bottom order of the device tree Example Following example code counts all nodes in the device tree. PROGRAM PLC_PRG VAR itfNode : DED.INode ; uiNodes : UINT ; END_VAR itfNode := DED.GetRoot (); REPEAT itfNode := DED.GetNextNode ( itfNode ); uiNodes := uiNodes + 1 ; UNTIL itfNode = 0 END_REPEAT InOut: Scope Name Type Comment Return GetNextNode INode Input itfCurrent INode node from which the search shall be started.
GetNodeDepth (FUN) ¶ FUNCTION GetNodeDepth : INT The function returns the depth of a node (i.e. number of parents between this node and the plc) InOut: Scope Name Type Return GetNodeDepth INT Input itfNode INode