Sercos3_IDNWrite4 (FB) ¶ FUNCTION_BLOCK Sercos3_IDNWrite4 This function block could be used to write Sercos III slave parameter. In contrast to Sercos3_IDNWrite only parameters not longer than 4 Bytes will be supported. The parameter to be written is specified by the IDN as used in the object dictionary. InOut: Scope Name Type Initial Comment Input xExecute BOOL On a rising edge at this input the reading of the slave parameter will be started. In order to get the internal channel deallocated, the instance must be called at least once by “xExecute:= FALSE”. xAbort BOOL FALSE If this parameter is TRUE, the current write process will be aborted. usiCom USINT 1 Number of the Sercos III master: If only one Sercos III master is used, usiCom is ‘1’. In case of multiple masters use ‘1’ for the first, ‘2’ for the second, etc. uiAddress UINT Topological address or Sercos address, depends on the parameter xIsSercosAddress xIsSercosAddress BOOL FALSE This input switches between topological address and Sercos address FALSE: uiAddress is the topological address TRUE: uiAddress is the Sercos address usiChannel USINT 1 Reserved for future extensions. Currently not used. dwIDN DWORD IDN (Identification Number) with 4 Bytes (SI (structure instance) and SE (structure element)) wElem WORD Value 7: Data value udiTimeOut UDINT Here you can set a timeout in milliseconds. If the writing of the parameter has not been finished within this time, an error message will be generated. abyData ARRAY [1..4] OF BYTE This array of 4 Bytes contains the data to be written If 1 byte have been written, this will be stored in index 1 of the array. Values of 2 resp. 4 bytes will be copied to the array according to Intel byte order. usiDataLength USINT Number of bytes to be written (1,2,4). Output xDone BOOL This output is TRUE as soon as the command has been finished successfully. xBusy BOOL This output is TRUE as long as the execution of the command has not been finished. xError BOOL This output is TRUE, if an error is detected. eError will show the cause. eError SERCOS3_ERROR This output shows the cause of the detected error, which is indicated by xError. For example ‘SERCOS3_TIMEOUT’ in case of an timeout. udiSercosError UDINT Error code if the function block has not been finished successfully.
IoDrvSercos ¶ ConfigStructs IoDrvSercos3 (FunctionBlock) AutoRestartMaster (Property) FirstSlave (Property) LastInstance (Property) NextInstance (Property) SERCOS_TOPOLOGY (Enum) Sercos3MasterGlobals (GVL) Sercos3Slave (FunctionBlock) IOControlStatusUsed (Property) IsConfigAsOptional (Property) LastInstance (Property) NextInstance (Property) SercosAddress (Property) SercosIndex (Property) SercosTopologyAddress (Property) SlaveActive (Property) SlaveOptional (Property) StatusWord (Property)
ConfigStructs ¶ /// for internal use only
IoDrvSercos3 (FB) ¶ FUNCTION_BLOCK IoDrvSercos3 EXTENDS IoDrvBase IMPLEMENTS ICmpIoDrvParameter The program organization unit IoDrvSercos3. For each Sercos master an instance of POU IoDrvSercos3 is created. The properties may be accessed respecting the syntax “<Instance name>.<Property name”. Examples of using the instance: Restart of master: SercosIII_Master.xRestart := xRestart SercosIII_Master(); Call of master to retrieve information about the success of downloading the configuration parameters: xFinish := SercosIII_Master.xConfigFinished; InOut: Scope Name Type Comment Input xRestart BOOL A rising edge at this input will restart the master. All configuration data will be reloaded. wRequiredTopology SERCOS_TOPOLOGY The required topology (Ring, L1, L2 etc) xRecoverRingTopology BOOL If a ring topology is required and a ring break was detected then it is possible to recover the ring topology with this input. Output xConfigFinished BOOL If the output is TRUE, the transmission of all configuration data has been executed properly. The communication on the bus is in process. wState WORD The parameter wState has a value between 0 and 100 telling about the state of the initialization phase; the greater the value, the more the initialization process is advanced. wTopology SERCOS_TOPOLOGY The current topology of the Sercos III bus. xTopologyError BOOL IF wRequiredTopologiy is not equal to wTopology there is an error. xBusError BOOL If the bus is not working then this output is set to true Properties: AutoRestartMaster FirstSlave LastInstance NextInstance Structure: AutoRestartMaster (Property) FirstSlave (Property) LastInstance (Property) NextInstance (Property)
IoDrvSercos3.AutoRestartMaster (PROP) ¶ PROPERTY AutoRestartMaster : BOOL gets or sets the auto master restart functionality
IoDrvSercos3.FirstSlave (PROP) ¶ PROPERTY FirstSlave : POINTER TO Sercos3Slave Pointer to the first slave of that master Example: Declaration: VAR pSlave : POINTER TO Sercos3Slave; END_VAR Program: pSlave := sercos_Master.FirstSlave; WHILE pSlave <> 0 DO pSlave^(); IF pSlave^.xError THEN ; END_IF pSlave := pSlave^.NextInstance; END_WHILE Initially, the first slave is fetched TO the master via sercos_Master.FirstSlave. In the WHILE loop the respective instance is called and xError is thus determined. The status can then be checked. The pointer to the next slave is fetched with pSlave^.NextInstance. If the list is finished, the pointer is ZERO and the loop ends.
IoDrvSercos3.LastInstance (PROP) ¶ PROPERTY LastInstance : POINTER TO IoDrvSercos3 Pointer to the previous master instance
IoDrvSercos3.NextInstance (PROP) ¶ PROPERTY NextInstance : POINTER TO IoDrvSercos3 Pointer to next master instance
SERCOS_TOPOLOGY (ENUM) ¶ TYPE SERCOS_TOPOLOGY : Enumeration for the detected topology mode InOut: Name Initial NO_LINK 16#0 LINE_P1 16#1 LINE_P2 16#2 DOUBLE_LINE 16#3 RING 16#4
Sercos3MasterGlobals (GVL) ¶ global variables for using the chained list of all master and slaves InOut: Name Type Initial Comment g_pSercos3FirstMaster POINTER TO IoDrvSercos3 0 Pointer to first master