Sign in to follow this  
Followers 0
CanaanP

Help with Timer (ML1500)

19 posts in this topic

Hi, I'm trying to setup a bit in my program to stay engaged only while a timer is timing. I have 9 integer files that I want to examine while the timer is timing, each one will extend the timer's preset if it is greater than 0. For example, a button is pushed that enables the bit and starts the timer, the preset is already set to 5 secs. While the timer is timing, the logic looks at n7:1, if it's greater than zero, add 5 more seconds to the timer's preset. Then, look at n7:2. If it's greater than zero add five more seconds. Etc, etc... So the timer's preset ends up being 5 seconds times how ever many N7's were greater than zero. Is this possible? I've been trying to do it, but it keeps getting to 32767. When the timer is finally done, I want that bit that was enabled to drop out, I haven't been able to get that far because of the overflow problem. Thanks in advance for any help available. Edited by CanaanP

Share this post


Link to post
Share on other sites
Without seeing your code I can only guess, but here's how I would do it. Let's say it is t4:0. Set up a rung with an XIC contact t4:0/tt. At the end start with a MOV 5 to some free N register. Let's choose n7:0. In parallel with this MOV we add a branch. On that branch we have a GRT box with N7:1 and zero. After that is ADD 5 N7:0. Contine with another branch extended down from this one. On it have a GRT of the next N7 register to be tested and another ADD 5 N7:0. Continue with as many branches you need. Finally end it with a MOV N7:0 T4:0.PRE.

Share this post


Link to post
Share on other sites
You should use the /tt bit of the timer. It sounds like you may be adding 5 to the timer on each scan of the rungs where the integer is greater than 0. If that is the case you need a flg bit so that each of the "add 5" rungs is only performed once.

Share this post


Link to post
Share on other sites
sorry, what is a flg bit?

Share this post


Link to post
Share on other sites
Bernie's logic will do it, but you may need a one shot too.

Share this post


Link to post
Share on other sites
Why a one shot? The way he worded it some register may go to non-zero while the timer is timing. Then again, something may return to zero during that time also. it was not specified what to do.

Share this post


Link to post
Share on other sites
ok, sorry for not being more specific. Here are some more details... n7:1 through 9 are used to store the values of which outputs will be activated in order. whatever value is in n7:1, that output will be enabled first, then the output corresponding to n7:2, etc... BUT not until the whole sequence is enabled. The users inputs the values into the n7's then hits the start button. The start button should enable the timer. The 5 seconds I was referring to earlier is actually being pulled from another integer file. So the user can specify how long to wait in between starts. That value is then taken and moved into the preset. N7:1 output is fired immediately, but also starts a seperate timer. When that timer is done, the rung for n7:2 is activated, so on and so forth. I want the whole startup sequence to drop back out when the last output has been fired. That is why I am asking about this new timer, I want it to control how long the startup sequence will be enabled for. I have a 2 rung flip flop type deal before each timer which adds n7:20( user input timer value) to the preset of that timer if n7:1 is greater than zero, if not it moves zero to that timer's preset. Therefore, the time it takes to start all outputs depends on how many n7's were greater than zero. It should be n7:20 x how ever many n7:1 through n7:9 were greater than zero. When the timer is dn, the start sequence drops out, and all the outputs that were chosen to start stay lit up. This all works except for dropping out the startup sequence when they are done starting.... that's what I'm trying to add in. Sorry if this is a mess, it's like that in my head too :) Thanks for your guys input, I really do appreciate it.

Share this post


Link to post
Share on other sites
As Miss Emily Latella would say "That's very different, nevermind" Seriously, can you post your current code? Then we might be able to help.

Share this post


Link to post
Share on other sites
Ok, here is my file. This works great as it is right now except that the start sequence does not drop out by itself when all starters are lit. That's all I want to add at this point. As I stated before, N7:1 through N7:9 are input by user, digits 1 through 9 in any one of them. That in turn fires the corresponding output. N7:20 is input as the amount of time between starts. Thanks for all the help!

Share this post


Link to post
Share on other sites
Ok, your probem with going to 32767 is as previously mentioned. You need a oneshot in rung 9. This will cause it to only add n7:20 to the preset once on the logic before the oneshot going true. Right now the rung will add N7:20 to the preset each scan that the tt bit is true and the GRT instruction evaluates true. If you add a OSR after the GRT you will make a good first start. I dont think I completely understand what you are trying to do with your logic. I'll have another look, but the OSR is big. Russell

Share this post


Link to post
Share on other sites
Your rung 9 references the TT bit and the preset of T4:1 but we never see the actual timer in this sequence. This rung really looks out of place. At the start the value from N7:1 is sent to N7:100. How long it is there is dependent on the preset of T4:2 which appear to be 1 second. That looks ok. After that, if N7;2 has a value it is sent to N7:100 but how long this is active is determined by if N7:3 has a value which influences the preset of T4:3. This pattern follows down the chain. Are you sure this is what you want? At the end when T4:9 is done the value (if any) from N7:9 is sent to N7:100 but there is no timer for the next event.

Share this post


Link to post
Share on other sites
Ok Rung 9 was there by accident, it was part of something I was trying yesterday and getting the overflow... I thought I caught em all but I missed that one. Sorry. B_Carlton, yes this is what I want. This program will allow a user to choose a starting order for modular conveyors. The user can also pick how long in between starts, n7:20. It's only 1 second right now for me testing it out. So slot 1 is n7:1, you tell the program, which conveyor is currently in slot1? Ok, conveyor 5, so I'll start output 5, then I'll wait (n7:20) seconds and look to see which conveyor is in slot2, oh it's number 4, bang output 4 is fired, etc etc. There is a VB app I wrote that interfaces with the plc, this will run on a pc touch screen. I know it is far from traditional, but this is what I want. Can you give a little advice on how the one shot works? Thanks :)

Share this post


Link to post
Share on other sites
How is B3:0/2 (START SEQUENCE ENABLE) turned on? As now written it must stay on for the sequence to execute. You could unlatch (OTU) it using the DN bit of T4:9. Then something else would have to turn it back on again.

Share this post


Link to post
Share on other sites
Well, working with this VB app, I have had to do things a bit differently with pushbuttons. Since none of the buttons in my app are "real" there is no need to use actual inputs. I'm directly toggling bits with the buttons on my screen. So on another ladder in my program, I have the start sequence enable bit, which starts off with a start button (normally open) stop button (nomally closed, and a branch for a hold in of the enable bit. It's a typical start/stop/holdin but without actual inputs. I will try using the t4:9.dn and see how that works. EDIT - I just remembered why I can't do that... there is a possibility that t4:9 will never be enabled, if that slot was never filled. That's why I need t4:1 to be timing only for the amount of time that is n7:20 times how ever many n7:1-n7:9 are greater than zero Edited by CanaanP

Share this post


Link to post
Share on other sites
I got it working using the one shot, I've attached the file if anyone wants to see it. I'm sure some of the gurus out there could have done it alot cleaner than this, but I'm happy :) Thanks for the input guys!

Share this post


Link to post
Share on other sites
T4:9 would always be enabled. Its preset might be zero but that's still 'enabled'. It's just that its DN bit would go ON as soon as it was enabled. And I still don't see where any contact from T4:1 is used. But as long as it's working I guess it doesn't matter.

Share this post


Link to post
Share on other sites
sorry I should have mentioned I put a normally open set of contacts for t4:1.tt in the startup sequence hold in branch, so it drops out when t4:1 is done. That in turn drops out all timers since there is a normally open in each timer rung for the startup sequence. The startup sequence start/stop/hold in/enable is all on another ladder, sorry :) Edited by CanaanP

Share this post


Link to post
Share on other sites
Keep the oneshot in mind whenever you do a math instruction that involves one of the operands as the result (ie, x+1=x; x-1=x, etc). Russell

Share this post


Link to post
Share on other sites
I noticed it's easy to get things jumbled up if that's what you mean... I'm working now on the shutdown subroutine of the same program and am having to be very careful not to get things confused... cuz the last motor to start needs to be the first to shutdown, etc... I'm getting a headache! But I think I've got it down. Everytime I post here I end up learning a bunch.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0