chihyuanting
hey, guys. when i try to compile this function block, i always get an error on compile for the get_char function. does anyone know the solution to this? i use openPLC v3 as the compiler. thank you. the function is pasted below

FUNCTION_BLOCK PIN_CODE_Block

VAR_INPUT
CB : BYTE;
E : BOOL;
PIN : STRING;
END_VAR


VAR_OUTPUT
_TP : BOOL;
END_VAR


VAR
POS : INT := 1;
END_VAR

the error on compile is shown below

_tp := FALSE;
IF e THEN

IF CB = INT_TO_BYTE(GET_CHAR(PIN,POS)) THEN
pos := pos + 1;
IF pos > LEN(PIN) THEN
_TP := TRUE;
pos := 1;
END_IF;
ELSE
pos := 1;
END_IF;
END_IF;

END_FUNCTION_BLOCK

this error is generated when i run the function
Generating C files...
./st_files/577110.st:23-31..23-32: error: ')' missing at the end of function invocation in ST expression.
./st_files/577110.st:23-32..24-7: error: invalid variable before ':=' in ST assignment statement.
./st_files/577110.st:23-32..23-31: error: expecting 'THEN' after test expression in ST 'IF' statement.
Reply 0 0
Reply