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)
WDELETE (FUN) ¶ FUNCTION WDELETE : WSTRING(255) Delete LEN wcharacters of STR, beginning at the POS-th character position. POS = 1 is the first character. Note The current implementation is unfortunately not correct for the case Pos=0 . The implementation cannot be changed for compatibility reasons. If Pos=0 is used, the parameter LEN is internally reduced by one! It is generally recommended to use values in the range specified by IEC 61131-3. The smallest value for Pos is specified there as 1 . InOut: Scope Name Type Return WDELETE WSTRING(255) Input STR WSTRING(255) LEN INT POS INT
WFIND (FUN) ¶ FUNCTION WFIND : INT Find the wcharacter position of the beginning of the first occurence of STR2 in STR1. If no occurence of STR1 is found, then the result is 0. InOut: Scope Name Type Return WFIND INT Input STR1 WSTRING(255) STR2 WSTRING(255)
WINSERT (FUN) ¶ FUNCTION WINSERT : WSTRING(255) Insert STR2 into STR1 after the POS-th wcharacter position. POS = 0 inserts before the first wcharacter. POS = 1 inserts after the first wcharacter. InOut: Scope Name Type Return WINSERT WSTRING(255) Input STR1 WSTRING(255) STR2 WSTRING(255) POS INT
WLEFT (FUN) ¶ FUNCTION WLEFT : WSTRING(255) Return leftmost SIZE wcharacters of STR. InOut: Scope Name Type Return WLEFT WSTRING(255) Input STR WSTRING(255) SIZE INT
WLEN (FUN) ¶ FUNCTION WLEN : INT String length function. Returns the number of wcharacters in STR. InOut: Scope Name Type Return WLEN INT Input STR WSTRING(255)
WMID (FUN) ¶ FUNCTION WMID : WSTRING(255) Return LEN characters of STR, beginning at the POS-th wcharacter position. POS = 1 is the first character. InOut: Scope Name Type Return WMID WSTRING(255) Input STR WSTRING(255) LEN INT POS INT