DaveBarnett Posted May 27 Share Posted May 27 I often use the CX command in the terminal or Watch window to quickly check out a subroutine. But, I've noticed a problem; The example subroutine below will work as expected if you call it from a PLC. But, if instead you call it from the command line: CX R0=1 ; CALL MySubTest Then, the P1 =0 statement will execute, but the P1 = 99 statement does not execute... strange.... open subprog MySubTest(dummy) P1 = 0 call Timer.msec(999) P1 = 99 // why doesnt this execute when we call from terminal? return close I tried replacing the call to the Timer subroutine with a local while loop, and the result is the same. Anyone have any idea why this is ?? And, more importantly, is there a work-around ? Thanks !! Quote Link to comment Share on other sites More sharing options...
leandro.martins Posted May 28 Share Posted May 28 It seems that works with the CPX command instead. 1 Quote Link to comment Share on other sites More sharing options...
DaveBarnett Posted May 28 Author Share Posted May 28 (edited) Indeed it does! (my firmware ver = 2.6.1.0) Thanks! I wonder... what's going on here ? Edited May 29 by DaveBarnett Quote Link to comment Share on other sites More sharing options...
leandro.martins Posted May 30 Share Posted May 30 Just for the records, the same happens for the firmware 2.7.1.0. My only guess is that the subprogram can't return to the program counter of the "PLC" that is executed by the CX command. However, when you do the same using the CPX command you can see in the Coord[x].Program.Number that a real program is allocated (probably temporarily) into the memory, making it possible to go back to that point after the subprogram returns. As I said, all of that is just a hypothesis based on my observations about the behaviour of the CX and CPX commands. Someone who knows what happens "under the hood" might correct me. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.