Roho Posted February 19, 2019 Report Share Posted February 19, 2019 I'm trying to write a program for a Samba to turn a motor on and off. I need to be able to input an on time and off time on the HMI and for it to run in a loop. I got that far as bastardized as my code may have been, but I need the timers to pause and not reset if they stop the motor for a period of time. He also wants to be able to set a TOTAL on timer that only counts the time while the motor is running. The bulk of my experience has been with Allen Bradley and while I love the Unitronics product, I'm having a little trouble adapting. Thanks for any and all help. On the one I attached I managed to put a counter in where they could set a number and it would stop after that number was reached, but the way I'm writing it doesn't allow it to be "paused" for repair or inspection without resetting the counters. DynoWithWorkingCounter1.vlp Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted February 19, 2019 MVP 2023 Report Share Posted February 19, 2019 Just a little bit of time to devote to this right now. I'll try to help more later. 21 minutes ago, Roho said: He also wants to be able to set a TOTAL on timer that only counts the time while the motor is running. I would not use a timer for this, merely increment a register every second of run time (or use SB 7 if you need more precision). You can then manipulate MI 0 (oops, I see now that I mistakenly used MI 0 instead of ML 0, which would be less likely to overflow) to display on the HMI in various ways or use for calculations. If you need timers to pause and not reset, then change your logic to use TA timers instead of TD timers, or use an incremented register or counter as I did above for the total run time. Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted February 19, 2019 MVP 2023 Report Share Posted February 19, 2019 @Cara Bereck Levy, I just noticed that the entire topic of Timer operands has disappeared from the Help file for VisiLogic 9.8.79. Can you look into this? @Roho, note that I made a small edit to my answer, changing TE to TA. Link to comment Share on other sites More sharing options...
Roho Posted February 19, 2019 Author Report Share Posted February 19, 2019 I had checked the help file, but I couldn't really find anything either. I'm sorry to bother ya'll, I'm just fumbling my way through this and realized a little help would be necessary. Thanks for any and all help you can give. Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted February 20, 2019 MVP 2023 Report Share Posted February 20, 2019 2 hours ago, Roho said: I'm sorry to bother ya'll, I'm just fumbling my way through this and realized a little help would be necessary. Thanks for any and all help you can give. Help is what we're here for, especially when you're attempting to work your way through it and not just asking for someone to write your program for you. I'm not sure why the Timer section of the help file got lost, but I'm sure Cara will get it fixed. I recommend not using the Beta version of the software for your first program. Were my suggestions on how to deal with the timer issues clear? I'm attaching a pdf of the Timers section from a previous version of VisiLogic that should help you understand the 3 different types of timer that VisiLogic offers. While it's fewer than the 15,000 different types A-B offers, these 3 (TD, TE, & TA) WILL get every job done with some careful thought. Timers.pdf Link to comment Share on other sites More sharing options...
Roho Posted February 20, 2019 Author Report Share Posted February 20, 2019 11 hours ago, Flex727 said: Were my suggestions on how to deal with the timer issues clear? Definitely helpful. You're right, A-B has your timer needs more than covered, and you'd think they would be harder and more complicated to use, but the new standard is the 3 timer setup, so I guess it's time to figure it all out. Thanks for the help. I don't have it yet, but I'm workin' on it. Link to comment Share on other sites More sharing options...
Roho Posted February 21, 2019 Author Report Share Posted February 21, 2019 Ok, I've gotten a very long way, and the way I got there may not be the best way, but it works.......ALMOST!!! It does everything I currently need, except for being able to hit stop when the motor is off. You hit stop while the motor is running and it pauses the timer beautifully, you hit stop when the motor is off and the off timer just keeps on going. I understand why, what I'm having trouble with is finding a solution that works anywhere in the cycle. As usual any and all suggestions are welcome. Thanks. DynoWithWorkingCounter3.vlp Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted February 21, 2019 MVP 2023 Report Share Posted February 21, 2019 49 minutes ago, Roho said: you hit stop when the motor is off and the off timer just keeps on going I presume that the only reason you care is that next time you hit START you want it to stay stopped until the off timer completes the previous cycle. If that's the case, given the logic you currently have in place, it looks to me like the easiest way would be to add a latch bit that indicates the status of the last press of the start or stop button, as follows: Link to comment Share on other sites More sharing options...
Roho Posted February 21, 2019 Author Report Share Posted February 21, 2019 Wow! This thing's had me so distraught I missed the forest for the trees! THANK YOU!!! Link to comment Share on other sites More sharing options...
Roho Posted February 21, 2019 Author Report Share Posted February 21, 2019 It's working! I had to start that latch bit in a set position so it threw me for a second, but it's doing what I need. Now to write an inc to count just the motor run time and figure how to display it on the HMI and it's golden. Thank you a million times over!!!! Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted February 21, 2019 MVP 2023 Report Share Posted February 21, 2019 2 hours ago, Roho said: It's working! Ah yes, the phrase every programmer longs to hear. Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted February 21, 2019 MVP 2023 Report Share Posted February 21, 2019 I'm going to hit up @Cara Bereck Levy one more time just in case she missed it. It looks like the Timers Help section was lost in the update to 9.8.79. Didn't this happen once before? Link to comment Share on other sites More sharing options...
Roho Posted February 22, 2019 Author Report Share Posted February 22, 2019 While it is alot closer to perfect, I'm still having a couple issues I'll post tomorrow as I'm sending this from home and don't have the file. One problem is how to reset the actual timers. They start back at the last stopping point no matter what so I need to figure a way to zero them. Also it's now starting with the off timer as opposed to the on timer, which I think it always did, but now it isn't running itself down before I hit start. I'll explain more tomorrow. Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted February 22, 2019 MVP 2023 Report Share Posted February 22, 2019 A TA accumulating timer must be manually reset. Just use a reset coil with the timer's address. Joe T. Link to comment Share on other sites More sharing options...
Roho Posted February 22, 2019 Author Report Share Posted February 22, 2019 I'm awfully close!! 2 problems. 1: I can't get the total test time from the incremental to the display in a usable format. 2: On initial startup, the off counter starts first. Plus if there's a time in either counter, it runs that time and then starts the new time. If you run a full cycle and don't change anything, it works perfectly each subsequent time, but if you do a fresh start or change a time it causes a problem. I'm not sure how else to describe the problem, but I tried the reset idea above, and nothing would run. There seemed to be a conflict due to the reset timer bit used earlier in the program. I'm excited that I'm close, but frustrated because it's still causing me grief. Thanks again for all your help. DynoWithWorkingCounter5.vlp Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted February 22, 2019 MVP 2023 Report Share Posted February 22, 2019 No time right now to analyze your logic, but I'll quickly show you how I do #1: Also, you need to change the timer display to Preset and adjust the Format: If your Total Test Time will exceed 24 hours, you'll need to do a bit of math to separate out and display the number of days. Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted February 22, 2019 MVP 2023 Report Share Posted February 22, 2019 A little bit of advice - if you hit an impasse, just try different things - you won't break the PLC. Make your best guess, implement, then go online with the PLC and see what is happening. If that doesn't work, make an adjustment and watch what happens. You'll home in on the solution eventually. No one always knows how to solve a logic problem on the first go. Link to comment Share on other sites More sharing options...
Roho Posted February 22, 2019 Author Report Share Posted February 22, 2019 I've been playing best guess like crazy. I've gotten through some of it, now I see I needed another function for the timer to work properly. You've been a big help. You deserve that top guru title!!! Link to comment Share on other sites More sharing options...
Roho Posted February 22, 2019 Author Report Share Posted February 22, 2019 The timer is working flawlessly now, thank you so much. I'll figure this other little glitch out in due time. 19 minutes ago, Flex727 said: 19 minutes ago, Flex727 said: Link to comment Share on other sites More sharing options...
Cara Bereck Levy Posted February 24, 2019 Report Share Posted February 24, 2019 On 2/22/2019 at 12:20 AM, Flex727 said: I'm going to hit up @Cara Bereck Levy one more time just in case she missed it. It looks like the Timers Help section was lost in the update to 9.8.79. Didn't this happen once before? Yes--it has happened before--I fixed it. I'm really sorry--I tried something this time that I hope will prevent this from ever happening again. .chm Help is a Microsoft invention, and the compiler hasn't been updated--or bug-fixed--since 2012. The database behind the Help sometimes corrupts, and loses objects--even though it compiles without error. I have a feeling it is due to nesting...anyway, I rebuilt some stuff. Hope it fixes the issue once and for all. Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted February 24, 2019 MVP 2023 Report Share Posted February 24, 2019 Thank you @Cara Bereck Levy! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now