Counter ¶ CTD (FunctionBlock) CTU (FunctionBlock) CTUD (FunctionBlock)
CTD (FB) ¶ FUNCTION_BLOCK CTD Decrements a given value (* Example declaration *) CTDInst : CTD ; (* Example in ST *) CTDInst ( CD := VarBOOL1 , LOAD := VarBOOL2 , PV := VarWORD1 ); VarBOOL3 := CTDInst.Q ; VarWORD2 := CTDInst.CV ; InOut: Scope Name Type Comment Input CD BOOL Rising edge: Decrementing CV by one LOAD BOOL TRUE : Set CV to the start value PV PV WORD Start value for decrementing Output Q BOOL TRUE if CV = 0 CV WORD Current counter value
CTU (FB) ¶ FUNCTION_BLOCK CTU Increments a given value (* Example declaration *) CTUInst : CTU ; (* Example in ST *) CTUInst ( CU := VarBOOL1 , RESET := VarBOOL2 , PV := VarWORD1 ); VarBOOL3 := CTUInst.Q ; VarWORD2 := CTUInst.CV ; InOut: Scope Name Type Comment Input CU BOOL Rising edge: Incrementing CV by one RESET BOOL TRUE : Reset CV to 0 PV WORD Upper limit for incrementing Output Q BOOL TRUE if CV >= PV CV WORD Current counter value
AtomicWriteULInt (FUN) ¶ FUNCTION AtomicWriteULInt : BOOL InOut: Scope Name Type Return AtomicWriteULInt BOOL Input pDest POINTER TO ULINT uliValue ULINT
Counter ¶ LCTD (FunctionBlock) LCTU (FunctionBlock) LCTUD (FunctionBlock)
LCTD (FB) ¶ FUNCTION_BLOCK PUBLIC LCTD Decrements a given value (* Example declaration *) LCTDInst : LCTD ; (* Example in ST *) LCTDInst ( CD := VarBOOL1 , LOAD := VarBOOL2 , PV := VarLWORD1 ); VarBOOL3 := CTDInst.Q ; VarLWORD2 := CTDInst.CV ; InOut: Scope Name Type Comment Input CD BOOL Rising edge: Decrementing CV by one LOAD BOOL TRUE : Set CV to the start value PV PV LWORD Start value for decrementing Output Q BOOL TRUE if CV = 0 CV LWORD Current counter value
LCTU (FB) ¶ FUNCTION_BLOCK PUBLIC LCTU Increments a given value (* Example declaration *) LCTUInst : LCTU ; (* Example in ST *) LCTUInst ( CU := VarBOOL1 , RESET := VarBOOL2 , PV := VarLWORD1 ); VarBOOL3 := CTUInst.Q ; VarLWORD2 := CTUInst.CV ; InOut: Scope Name Type Comment Input CU BOOL Rising edge: Incrementing CV by one RESET BOOL TRUE : Reset CV to 0 PV LWORD Upper limit for incrementing Output Q BOOL TRUE if CV >= PV CV LWORD Current counter value
LCTUD (FB) ¶ FUNCTION_BLOCK PUBLIC LCTUD Increments and decrements a given value (* Example declaration *) LCTUDInst : LCUTD ; (* Example in ST *) LCTUDInst ( CU := VarBOOL1 , CD := VarBOOL2 , RESET := VarBOOL3 , LOAD := VarBOOL4 , PV := VarLWORD1 ); VarBOOL5 := CTUDInst.QU ; VarBOOL6 := CTUDInst.QD ; VarLWORD2 := CTUDInst.CV ; InOut: Scope Name Type Comment Input CU BOOL Rising edge: Incrementing CV by one CD BOOL Rising edge: Decrementing CV by one RESET BOOL TRUE : Reset CV to 0 LOAD BOOL TRUE : Set CV to the start value PV PV LWORD Start value for decrementing / upper limit for incrementing Output QU BOOL TRUE if CV >= PV QD BOOL TRUE if CV = 0 CV LWORD Current counter value
String Functions ¶ WCONCAT (Function) WDELETE (Function) WFIND (Function) WINSERT (Function) WLEFT (Function) WLEN (Function) WMID (Function) WREPLACE (Function) WRIGHT (Function)
WCONCAT (FUN) ¶ FUNCTION WCONCAT : WSTRING(255) Concatenation of two wstrings. InOut: Scope Name Type Return WCONCAT WSTRING(255) Input STR1 WSTRING(255) STR2 WSTRING(255)