teaguehall Posted December 15, 2016 Share Posted December 15, 2016 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) { }; close 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 2.1.1.3 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 More sharing options...
Omron Forums Support Posted December 16, 2016 Share Posted December 16, 2016 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. Link to comment Share on other sites More sharing options...
teaguehall Posted December 16, 2016 Author Share Posted December 16, 2016 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 More sharing options...
Recommended Posts