Martin Posted February 7, 2017 Report Posted February 7, 2017 Hi new to this. I am trying to create a countdown timer. F6 starts the countdown from a keypad entered number Hours and Minutes. F7 Pauses timer. When the timer is in the on state ie. counting down I wish for a relay to be activated. I'm using a V280 with a V200-18-E2B i/o snap in. At a later point I'm going to require the total time multiplied by a predetermined Current reading as a total in milli-amp hours. I've read just about everything posted about timers but can't seam to find anything relevant.Attached is my effort.It doesn't work I can change the numeric value of the timer but it won't Start. Any help would be greatly appreciated. Thanks Martin
MVP 2023 Joe Tauser Posted February 8, 2017 MVP 2023 Report Posted February 8, 2017 You don't mention how you want to reset the timer. You need to make your own timer to get it to behave the way you want to. Use an MI or ML as an accumulator. The easiest way to get the preset is to use separate MI's on the HMI screen and combine them into a preset value. Then decrement the value with the internal second pulse SB 13. This should get you started: Joe T. 1
Cam Posted February 8, 2017 Report Posted February 8, 2017 Ummmm... Joe shouldn't net 5 have a contact for MB 0? Otherwise the start and pause logic in nets 3 & 4 won't have any effect and the timer will just decrement to infinity. 1
Martin Posted February 8, 2017 Author Report Posted February 8, 2017 Thank you Joe, I've been experimenting with your ladder, What I need to be able to do is :Keypad entry the time max 24hrs60min60sec to countdown to zero Start when F6 pressed and Stop when F7 pressed to reset I was hoping that when ESC pressed the timer would flash allowing new time to be set by keypad. I've tried linking timers and counters from the screen but to no avail. Thanks again Martin.
MVP 2023 Joe Tauser Posted February 8, 2017 MVP 2023 Report Posted February 8, 2017 13 hours ago, Cam said: Ummmm... Joe shouldn't net 5 have a contact for MB 0? Otherwise the start and pause logic in nets 3 & 4 won't have any effect and the timer will just decrement to infinity. Yes. I have a standard policy that my code never works right the first time! Hence the comment "get you started". I assume some intelligence on the other side to take what I've done and run with it. Martin - It sounds like you want a timer like you'd buy at the store for cooking, where you enter the time and it counts down from there. We can't do that in Unitronicsland with a standard timer. Sorry. First, if you look at the timers and counters variable type you can either display the preset or the remaining time. One variable can not display both. You need to understand that the code I posted does not use timers and counters at all, and the point of using SB 13 is that you are making your own timer to get the functionality you want. Do not try to link standard timers and counters to it. Post the .vlp program you've been working on and I can hack it a bit. Joe T. 1
MVP 2023 Flex727 Posted February 8, 2017 MVP 2023 Report Posted February 8, 2017 12 minutes ago, Joe Tauser said: I have a standard policy that my code never works right the first time! Okay, I'm stealing this. 2
Martin Posted February 8, 2017 Author Report Posted February 8, 2017 Hi Joe thanks for all your trouble not sure that there's any point posting my vlp as it's crap. I thought that a countdown timer would be simple. Not so worried about the total at the mo as it will require FB's and not sure how to o/p them as I need to speak to the network manager. Thanks again Martin
MVP 2023 Joe Tauser Posted February 8, 2017 MVP 2023 Report Posted February 8, 2017 There is no crap while the program is still in the development stage - only un-molded clay. Post what you've done and we can help you understand timers better. I wrote the code I did because you want to do mathematical operations with the timer values, and that's not intuitive on time values. Under the hood, the PLC counts in 0.01 second increments. The approach may be to use timers at first so you get used to working the the HMI. Joe T.
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