Jump to content
OMRON Forums

When calling subprogams from command line, Sys.Time doesn't update


Recommended Posts

I'm hoping to get some type of confirmation on this issue.


When a PMAC script subprogram contains a call to the system timer (i.e. Sys.Time), the subprogram does not appear to function correctly when called from the command line.


For example:


open subprog timer(time)


local stop_time;

stop_time = sys.time + time;


while(sys.time < stop_time) { };




This program can be called just fine from within a PLC, however, it appears to get hung when called with a 'cx' command from the command line. It appears that sys.time doesn't increment.


PMAC firmware version


Edit: I'm thinking this is due to the fact that the subprogram isn't being called from within a PLC, thus it doesn't adhere to the typical PLC scan engine. If this is the case, the better question would be "how does a script subprogram execute if not called within a PLC?"

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I'm assuming the command you used was something like this.

cx call timer(60)

However that gives me the error.

stdin:17:3: error #31: invalid data: cx call Timer(60)

without pausing sys.time.

Please let me know what you typed into the terminal.


When calling subprograms from the command line, you need to specify your arguments and return values differently.


So in the case of calling timer, it would be something like


cx r0 = 60 call timer


You assign 60 as the first function argument.

Link to comment
Share on other sites

This topic is now closed to further replies.

  • Create New...