Test case R0012
Full test suiteDevice test case
AT vars with Globals
This test case it part of the test suite proposed for new devices.
Test case ID: R0012
Language: ST
tests2/t0012.st(* AT vars with globals *) (* this requires a DRV implementation that works in memory *) PROGRAM AT0012 VAR_GLOBAL I61_2 AT %IW61.2 : INT; Q62_8 AT %QW62.8 : INT; M63_8 AT %MW63.8 : INT; END_VAR END_PROGRAM PROGRAM T0012 VAR_EXTERNAL _T_PARAMS : TEST_PARAMS; I61_2 : INT; Q62_8 : INT; M63_8 : INT; END_VAR VAR LI61_1 AT %IW61.1 : INT; LI61_2 AT %IW61.2 : INT; (* this points to same location as I61_2 *) LQ62_7 AT %QW62.7 : INT; LQ62_8 AT %QW62.8 : INT; (* this points to same location as Q62_8 *) LM63_7 AT %MW63.7 : INT; LM63_8 AT %MW63.8: INT; (* this points to same location as M63_8 *) END_VAR (* inputs are at zero *) LM63_7 := LM63_7 + 10 + LI61_1; LM63_8 := LM63_8 + 10 +LI61_2; M63_8 := M63_8 + 10 + I61_2; (* this -toghether with the previous- results in M63_8 incremented in 20 *) Q62_8 := 3; LQ62_7 := 4; LQ62_8 := 5; _GEB_ASSERT_( LM63_8 = M63_8); _GEB_ASSERT_( LI61_2 = I61_2); _GEB_ASSERT_( LQ62_8 = Q62_8); IF _T_PARAMS.cycle = 3 THEN (* after 3 cycles *) _GEB_MSG_( INT_TO_STRING(LM63_8)); _GEB_ASSERT_( LM63_7 = 30); _GEB_ASSERT_( M63_8 = 60); END_IF; END_PROGRAM