DELETE (FUN) ¶ FUNCTION DELETE : STRING(255) Deletes a number of characters from a string DELETE (STR, LEN, POS) means: Delete LEN characters from STR , beginning with the character in the POS position. POS = 0 or POS = 1 , are both addressing 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 . (* Example declaration *) VarSTRING1 : STRING ; (* Example in ST , result is 'SUSI' *) VarSTRING1 := DELETE ( 'SUXYSI' , 2 , 3 ); InOut: Scope Name Type Comment Return DELETE STRING(255) String remaining after deletion Input STR STRING(255) String to be modfied LEN INT Length of the partial string to be deleted, number of characters POS INT Position in STR after which the deletion starts. Counted from left, starting with 1
FIND (FUN) ¶ FUNCTION FIND : INT Searches for the position of a partial string within a string. FIND(STR1, STR2) means: Find the position of the first character where STR2 appears in STR1 for the first time. If STR2 is not found in STR1, then OUT:=0. (* Example declaration *) arINT1 : INT ; (* Example in ST , result is '4' *) arINT1 := FIND ( 'abcdef' , 'de' ); InOut: Scope Name Type Comment Return FIND INT Character position of the first occurance of STR2 in STR1 . If no occurance is found, result is 0 Input STR1 STRING(255) String within which STR2 is searched STR2 STRING(255) String whose position is searched in STR1
LEFT (FUN) ¶ FUNCTION LEFT : STRING(255) Returns a specific number of characters of a string, starting from left LEFT (STR, SIZE) means: Return the first SIZE characters from the left in string STR (* Example declaration *) VarSTRING1 : STRING ; (* Example in ST , result is 'SUS' *) VarSTRING1 := LEFT ( 'SUSI' , 3 ); InOut: Scope Name Type Comment Return LEFT STRING(255) Resulting string Input STR STRING(255) String to be analyzed SIZE INT Number of characters
LEN (FUN) ¶ FUNCTION LEN : INT Returns the number of characters of a string (* Example declaration *) VarINT1 : INT ; (* Example in ST , result is '4 *) VarINT1 := LEN ( 'SUSI' ); InOut: Scope Name Type Comment Return LEN INT Length of string STR Input STR STRING(255) String to be analyzed
MID (FUN) ¶ FUNCTION MID : STRING(255) Returns a specific number of characters of a string, starting from a specific position MID (STR, LEN, POS) means: Retrieve LEN characters from the STR string beginning with the character at position POS . (* Example declaration *) VarSTRING1 : STRING ; (* Example in ST , result is 'US' *) VarSTRING1 := MID ( 'SUSI' , 2 , 2 ); InOut: Scope Name Type Comment Return MID STRING(255) Partial string of STR Input STR STRING(255) String to be analyzed LEN INT Number of characters, counted from the left POS INT Start position for the partial string
REPLACE (FUN) ¶ FUNCTION REPLACE : STRING(255) Replaces a specific number of characters of a string by another string REPLACE(STR1, STR2, L, P) means: Replace L characters from STR1 by STR2 , beginning with the character in the P position. POS = 0 or POS = 1 , are both addressing the first character. Note The current implementation is unfortunately not correct for the case P=0 . The implementation cannot be changed for compatibility reasons. If P=0 is used, the parameter L is internally reduced by one! It is generally recommended to use values in the range specified by IEC 61131-3. The smallest value for P is specified there as 1 . (* Example declaration *) VarSTRING1 : STRING ; (* Example in ST , result is 'SKYSI' *) VarSTRING1 := REPLACE ( 'SUXYSI' , 'K' , 2 , 2 ); InOut: Scope Name Type Comment Return REPLACE STRING(255) Resulting string Input STR1 STRING(255) String of which a part is replaced STR2 STRING(255) String which replaces a part of STR1 L INT Number of characters, counting from left P INT Start position of the characters to be replaced. P = 1 or P = 0 are both addressing the first character
RIGHT (FUN) ¶ FUNCTION RIGHT : STRING(255) Returns a specific number of characters of a string, starting from right RIGHT (STR, SIZE) means: Return the first SIZE characters from the right in string STR (* Example declaration *) VarSTRING1 : STRING ; (* Example in ST , result is 'USI' *) VarSTRING1 := RIGHT ( 'SUSI' , 3 ); InOut: Scope Name Type Comment Return RIGHT STRING(255) Resulting string Input STR STRING(255) String to be analyzed SIZE INT Number of characters
Timer ¶ TOF (FunctionBlock) TON (FunctionBlock) TP (FunctionBlock)
TOF (FB) ¶ FUNCTION_BLOCK TOF Implements a timer with a turn-off delay (* Example declaration *) TOFInst : TOF ; (* Example in ST *) TOFInst ( IN := VarBOOL1 , PT := T#5s ); VarBOOL2 := TOFInst.Q ; InOut: Scope Name Type Comment Input IN BOOL Falling edge: starts delay counter Rising edge: resets delay counter PT TIME Time for the delay counter [ms] Output Q BOOL TRUE if IN is TRUE FALSE if IN is FALSE and delay time PT elapsed ET TIME Elapsed time since falling edge at IN
TON (FB) ¶ FUNCTION_BLOCK TON Implements a timer with a turn-on delay (* Example declaration *) TONInst : TON ; (* Example in ST *) TONInst ( IN := VarBOOL1 , PT := T#5s ); VarBOOL2 := TONInst.Q ; InOut: Scope Name Type Comment Input IN BOOL Rising edge: starts delay counter Falling edge: resets delay counter PT TIME Time for the delay counter [ms] Output Q BOOL FALSE if IN is FALSE TRUE if IN is TRUE and delay time PT elapsed ET TIME Elapsed time since rising edge at IN