Test case R0140
Full test suiteDevice test case
ENO output in FunctionBlocks
This test case it part of the test suite proposed for new devices.
Test case ID: R0140
Language: ST
tests2/t0140.st// runs 3 times (nrun=0,1,2) PROGRAM R0140 VAR x, y, w : INT; fb : FB_R0140; // persists among runs END_VAR VAR_TEMP fb2 : FB_R0140; // does not persist among runs END_VAR VAR_EXTERNAL _T_PARAMS : TEST_PARAMS; END_VAR x := 3; fb( X := x, Y => y ); // fb.Y=103+20*nrun 103 123 143 (copied) fb.Z = 110+20*nrun 110 130 150 fb2( X := x, Y => w ); // fb2.Y=103 fb2.Z = 110 x := 6; fb( X := x, Y => y ); // fb.Y = 116+20*nrun 116 136 156=>not copied fb.Z=120+20*nrun 120 140 160 fb2( X := x, Y => w ); // fb2.Y=116 fb2.Z = 120 IF _T_PARAMS.cycle = _T_PARAMS.timestorun THEN // last iteration _GEB_ASSERT_(fb.X=6); _GEB_ASSERT_(fb.Y=156); _GEB_ASSERT_(y = 143); _GEB_ASSERT_(w = 116); END_IF; END_PROGRAM (* sets Y=X +Z , and ENO=false if Y>150; Z starts at 100, increments by 10 *) FUNCTION_BLOCK FB_R0140 VAR_INPUT X : INT; END_VAR VAR Z : INT := 100; END_VAR VAR_OUTPUT Y : INT; END_VAR Y := X + Z; IF Y > 150 THEN ENO := FALSE; END_IF; Z := Z + 10; END_FUNCTION_BLOCK