Test case R0180
Full test suiteDevice test case
Several function calling syntaxes (CAL) in IL
This test case it part of the test suite proposed for new devices.
Test case ID: R0180
Language: ST,IL
tests2/t0180a.il(* ref: table 53 p 127 *) (* ref: table 53 p 127 *) FUNCTION FZ_R0180 : INT // returns 42 VAR_INPUT in : BOOL; END_VAR LD in //this does nothing LD 42 ST FZ_R0180 END_FUNCTION FUNCTION FZ2_R0180 : INT // returns the same number passed as input VAR_INPUT in1 : BOOL; in2: INT; END_VAR LD in1 //this does nothing LD in2 ST FZ2_R0180 END_FUNCTION FUNCTION_BLOCK FBZ_R0180 // sets out:= 43 VAR_INPUT in : BOOL; END_VAR VAR_OUTPUT out : INT; END_VAR LD in LD 43 ST out END_FUNCTION_BLOCK PROGRAM R0180 VAR_GLOBAL i1, i2, i23, i3, i4, i5 : INT; END_VAR VAR a : BOOL; b : FBZ_R0180; END_VAR LD TRUE ST a // a := TRUE LD a FZ_R0180 // Call function with informal arguments (case 5; 0+1 args) ST i1 // i1 := 42 LD 23 ST i2 LD a FZ2_R0180 i2 // Call function with informal arguments (case 5 ; 1+1 args) ST i23 // i23 := 23 FZ_R0180( in := a ) // Call function with formal arguments (case 4) ADD 3 ST i2 // i2 := 42+3=45 // Call function block with formal arguments (case 1b) CAL b( in := a , out => i3 ) // i3 := 43 // Call function block with informal arguments (case 1a) NOT SUPPORTED NOW //CAL b( a , i4 ) // i4 := 43 LD a ST b.in // Call function block with load & store operators (case 2) CAL b LD b.out ST i5 // i5 := 43 END_PROGRAMtests2/t0180b.stPROGRAM Z_R0180 VAR_EXTERNAL i1, i2, i23, i3, i4, i5 : INT; END_VAR _GEB_ASSERT_(i1 = 42); _GEB_ASSERT_(i2 = 45); _GEB_ASSERT_(i23 = 23); _GEB_ASSERT_(i3 = 43); (* _GEB_ASSERT_(i4 = 43); *) _GEB_ASSERT_(i5 = 43); END_PROGRAM