PROGRAMPLC_PRGVAR
Β Β i : BYTE;
Β Β Test : WORD;END_VARFORi:=0TO255DO
Β Β Test :=Test+1;END_FOR;Test :=0;
There is a mistake in the IEC61131 compiler, the loop exit condition must be verified before increasing the i value and when exiting just increase once more like other compilers.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is a mistake in the IEC61131 compiler, the loop exit condition must be verified before increasing the i value and when exiting just increase once more like other compilers.
no you are in error, as it is overflowing,
when the test is on zero before adding it would not start at all
when the test is on 255 then it would not run the last one. And yes correct you get endless loop.
this is same for word and dword and for int,dint all same problem.
very old problem even in machinelanguage was this a problem.