vanquangtk Posted June 5, 2016 Report Posted June 5, 2016 Hello everyone. I have a problem when programing for a machine system with NJ by Sysmac studio. When I need to restart the system, I need to reset some variable in the program. Before, in Mitsubishi PLC, I just need to use ZRST to reset all variable I want in once time. But I can't find any function like that in Sysmac. I must reset every variable one by one. This is so annoying and boring too, Does any one know how to solve my problem. Thank you so much. Quote
Michael Walsh Posted June 5, 2016 Report Posted June 5, 2016 You can assign initial values to any variable in the variable table. No code needed at all. Quote
vanquangtk Posted June 5, 2016 Author Report Posted June 5, 2016 7 minutes ago, Michael Walsh said: You can assign initial values to any variable in the variable table. No code needed at all. But that variable only reset when the power off and turn on again. The thing I want is I just need do press a button and all variables will be reset Quote
Michael Walsh Posted June 5, 2016 Report Posted June 5, 2016 You could use the inline structured text function to reset all in one instruction. Quote
vanquangtk Posted June 5, 2016 Author Report Posted June 5, 2016 Just now, Michael Walsh said: You could use the inline structured text function to reset all in one instruction. I'm sorry but I don't understand what you mean. May you give ma an example, thank you Quote
IO_Rack Posted June 6, 2016 Report Posted June 6, 2016 (edited) The NJ is a much different platform than previous PLC programming that you may be used to. If you can manage the programming time, you should go back and re-structure your variables. If a range of consecutive memory requires operations both individually and as a group, there are a few different ways to accomplish this. Create a Union then create your variables as the Union Name. For example: Another method is to create an Array of your variables. In this case all the variables would need to be the same Data Type. I haven't done much ST programming but to do as Michael suggests, right click your rung then choose "Insert Inline ST". I don't know exactly how at this moment but I'm sure you could set all your variables to FALSE or to #0 or whatever you need them to be, all in one ST box. Edited June 6, 2016 by IO_Rack 1 Quote
Michael Walsh Posted June 7, 2016 Report Posted June 7, 2016 On 6/5/2016 at 10:21 AM, vanquangtk said: I'm sorry but I don't understand what you mean. May you give ma an example, thank you You can add an inline structured text block like IO_Rack mentioned and then populate it with as many lines of code to reset any variable you want. This would need to be done if variables were not arrays or structures. As IO_Rack also mentions, arrays or structures could be cleared with the Clear command. 1 Quote
vanquangtk Posted June 8, 2016 Author Report Posted June 8, 2016 8 hours ago, Michael Walsh said: You can add an inline structured text block like IO_Rack mentioned and then populate it with as many lines of code to reset any variable you want. This would need to be done if variables were not arrays or structures. As IO_Rack also mentions, arrays or structures could be cleared with the Clear command. Thank you so much, I got it now Quote
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.
Note: Your post will require moderator approval before it will be visible.