Runtime Utility Center is a very powerful tool for setting up PLCs, getting information from the PLCs software, and so on.
For my usecase, I needed to repeat some functionality / commands for a limited number of calls, and then go on with the pil instructions, but as I know RUC doesn’t have internal counters or calcuation instructions.
I used a batch file for counting, and I want to share a simple sample here, maybe someone else also have the need for doing something similar.
The sample is pretty easy:
- use a RUC internal variable as counter value storage
- call a batch file with the counter value as input parameter
- do the calculation inside the batch file (in the sample, adding +1 to the input value), and return the calculation result as batch file return value
- store the batch file return value in the RUC internal variable
In this example, the IF GOTO statement and the internal variable of RUC is used together with the “increase by 1” batch file to realize a limited number (10 times) of executions of the same RUC actions … here, opening a message box showing the counter value, which of course makes pretty less sense…
… But the’re also serious use-cases out there for basic counting / calculations in PIL lists, so happy RUC’ing
TestCounterInPil.zip (869 Bytes)