Robert Richter
Member
I am trying to do a subroutine using a Q series (Q06UDEH) plc and GXWorks 2. The manual says to use a FEND and then start the subroutines. Each subroutine (started after then FEND statement) has a return statement. Whenever I make a call to a subroutine I get fault 4211 that a FEND was encountered after a CALL and before a return was encountered.
One thing that looks interesting is when I display compile results, my return statements are compiled as JMP P2069, and P2069 is the pointer shown in the compile result of the last line of the last rung of code. It looks like a return statement is not being compiled as a return, but jumping to the end and maybe hitting into a hidden FEND. I have found that I cannot get an error 4212 by putting a return statement near the start of the code (before the FEND), and the manual says error 4212 will result if return is encountered before FEND. It just happily quits scanning that routine, the same as if I had put a FEND there.
Anyone know what I am doing wrong? I am trying to use structured ladder. It needs to not think return and FEND are the same thing.
One thing that looks interesting is when I display compile results, my return statements are compiled as JMP P2069, and P2069 is the pointer shown in the compile result of the last line of the last rung of code. It looks like a return statement is not being compiled as a return, but jumping to the end and maybe hitting into a hidden FEND. I have found that I cannot get an error 4212 by putting a return statement near the start of the code (before the FEND), and the manual says error 4212 will result if return is encountered before FEND. It just happily quits scanning that routine, the same as if I had put a FEND there.
Anyone know what I am doing wrong? I am trying to use structured ladder. It needs to not think return and FEND are the same thing.