Jump to content
OMRON Forums

CX command failing


Recommended Posts

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 !!

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...