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
Sercos3Slave (FB) ¶ FUNCTION_BLOCK Sercos3Slave For each Sercos slave an instance of POU Sercos3Slave is created. The properties may be accessed respecting the syntax “<Instance name>.<Property name”. InOut: Scope Name Type Initial Comment Output xError BOOL FALSE This output is set to true if an error occured and no realtime data is exchanged Properties: IOControlStatusUsed IsConfigAsOptional LastInstance NextInstance SercosAddress SercosIndex SercosTopologyAddress SlaveActive SlaveOptional StatusWord Structure: IOControlStatusUsed (Property) IsConfigAsOptional (Property) LastInstance (Property) NextInstance (Property) SercosAddress (Property) SercosIndex (Property) SercosTopologyAddress (Property) SlaveActive (Property) SlaveOptional (Property) StatusWord (Property)
Sercos3Slave.IOControlStatusUsed (PROP) ¶ PROPERTY IOControlStatusUsed : BOOL get or set if Control status word is used in connection
Sercos3Slave.IsConfigAsOptional (PROP) ¶ PROPERTY IsConfigAsOptional : BOOL Returns true if optional flag is set in configuration