| <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| <!DOCTYPE FBType SYSTEM "http://www.holobloc.com/xml/LibraryElement.dtd"> |
| <FBType Comment="Event-Driven Up-Down Counter" Name="E_CTUD"> |
| <Identification Classification="Event-driven blocks" Description="Copyright (c) 2017 fortiss GmbH 			 2019 Johannes Keppler University Linz This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/ SPDX-License-Identifier: EPL-2.0" Function="Up-Down-counter" Standard="61499-1-A.x"/> |
| <VersionInfo Author="Alois Zoitl" Date="2017-09-22" Organization="fortiss GmbH" Remarks="initial API and implementation and/or initial documentation" Version="1.0"/> |
| <VersionInfo Author="Alois Zoitl" Date="2019-07-09" Organization="JKU" Remarks="fixed bug in down counting" Version="1.1"/> |
| <CompilerInfo/> |
| <InterfaceList> |
| <EventInputs> |
| <Event Comment="Count Up" Name="CU" Type="Event"> |
| <With Var="PV"/> |
| </Event> |
| <Event Comment="Count Down" Name="CD" Type="Event"/> |
| <Event Comment="Reset" Name="R" Type="Event"/> |
| <Event Comment="Load" Name="LD" Type="Event"> |
| <With Var="PV"/> |
| </Event> |
| </EventInputs> |
| <EventOutputs> |
| <Event Comment="Count Output Event" Name="CO" Type="Event"> |
| <With Var="QU"/> |
| <With Var="CV"/> |
| <With Var="QD"/> |
| </Event> |
| <Event Comment="Reset Output Event" Name="RO" Type="Event"> |
| <With Var="QU"/> |
| <With Var="CV"/> |
| <With Var="QD"/> |
| </Event> |
| <Event Comment="" Name="LDO" Type="Event"> |
| <With Var="QU"/> |
| <With Var="QD"/> |
| <With Var="CV"/> |
| </Event> |
| </EventOutputs> |
| <InputVars> |
| <VarDeclaration Comment="Preset Value" Name="PV" Type="UINT"/> |
| </InputVars> |
| <OutputVars> |
| <VarDeclaration Comment="CV >=PV" Name="QU" Type="BOOL"/> |
| <VarDeclaration Comment="CV <= 0" Name="QD" Type="BOOL"/> |
| <VarDeclaration Comment="" Name="CV" Type="UINT"/> |
| </OutputVars> |
| </InterfaceList> |
| <BasicFB> |
| <ECC> |
| <ECState Comment="" Name="START" x="1330.0" y="950.0"/> |
| <ECState Comment="" Name="CU" x="190.0" y="570.0"> |
| <ECAction Algorithm="CountUp"/> |
| <ECAction Algorithm="UpdateQUQD" Output="CO"/> |
| </ECState> |
| <ECState Comment="" Name="R" x="190.0" y="1330.0"> |
| <ECAction Algorithm="Reset"/> |
| <ECAction Algorithm="UpdateQUQD" Output="RO"/> |
| </ECState> |
| <ECState Comment="" Name="CD" x="1710.0" y="570.0"> |
| <ECAction Algorithm="CountDown"/> |
| <ECAction Algorithm="UpdateQUQD" Output="CO"/> |
| </ECState> |
| <ECState Comment="" Name="LD" x="1805.0" y="1330.0"> |
| <ECAction Algorithm="Load"/> |
| <ECAction Algorithm="UpdateQUQD" Output="LDO"/> |
| </ECState> |
| <ECTransition Comment="" Condition="CU[(CV<65535)]" Destination="CU" Source="START" x="145.0" y="1100.0"/> |
| <ECTransition Comment="" Condition="1" Destination="START" Source="CU" x="495.0" y="935.0"/> |
| <ECTransition Comment="" Condition="R" Destination="R" Source="START" x="710.0" y="1125.0"/> |
| <ECTransition Comment="" Condition="1" Destination="START" Source="R" x="745.0" y="1240.0"/> |
| <ECTransition Comment="" Condition="CD[(CV > 0)]" Destination="CD" Source="START" x="1460.0" y="705.0"/> |
| <ECTransition Comment="" Condition="1" Destination="START" Source="CD" x="1780.0" y="925.0"/> |
| <ECTransition Comment="" Condition="LD" Destination="LD" Source="START" x="1825.0" y="1145.0"/> |
| <ECTransition Comment="" Condition="1" Destination="START" Source="LD" x="1515.0" y="1275.0"/> |
| </ECC> |
| <Algorithm Comment="Count Up" Name="CountUp"> |
| <ST Text="CV := CV + 1; "/> |
| </Algorithm> |
| <Algorithm Comment="Reset" Name="Reset"> |
| <ST Text="CV := 0; "/> |
| </Algorithm> |
| <Algorithm Comment="ALG" Name="Load"> |
| <ST Text="CV := PV;"/> |
| </Algorithm> |
| <Algorithm Comment="ALG" Name="UpdateQUQD"> |
| <ST Text="QU := (CV >= PV); QD := (CV = 0);"/> |
| </Algorithm> |
| <Algorithm Comment="ALG" Name="CountDown"> |
| <ST Text="CV := CV - 1;"/> |
| </Algorithm> |
| </BasicFB> |
| </FBType> |