Timers again?

c.s.barnett

Member
Join Date
Dec 2002
Location
Arizona
Posts
4
Let me try this again, last night I had a lot going on. Acording to my instructor this can be done, and I have an idea (BUTT??)"Write a PLC ladder program that while I:0/0 is off(low) T4:0 will time up to 4 sec, then reset itself and while I:0/0 is on (HIGH)T4:0 will time up to 7 sec then reset itself. beerchug
 
It can be done, but why do it? The only reason I can see to do it is if you were very limited on the number of timers you had available.

Here's a hint. You have to change the preset value of the Timer. T4:0.PRE
 
The code for this is fairly easy. The problem is, it's so easy, that it's hard to give you hints without doing the code for you. It may be ego gratifying for us to show how smart we are to eachothr (but we already know that), but it doesn't do YOU any good.

Your instructor doesn't want the ANSWERS - I'm sure he's got it. He wants YOU to work out the answer.

But I understand: You're stuck. What I don't understand is: Stuck where?

Post something - anything - to show where you are stuck, and then we can give hints to unstick you.

Without that, we are ROBBING YOU of an eduction. We're here to give, not to take.

Here's are two hints:

You were right about the MOV.

Just what do you mean by "then reset itself"?
  • Do you mean that while I:0/0 is (HIGH), T$:0 will time to 7 seconds over and over and over again?
  • Or do you mean that it will time to 7 seconds, reset, and stop?
  • Or do you mean that it will time to 7 seconds, but reset when I:0/0 goes (LOW)?

The three scenarios produce very different code. Which are you after?

Good luck!

(Tip on posting ladder here: First put down the vBcodes [LADDER ] and [/LADDER ] (without the extra space in the bracket, and with a blank lines between). In the space between, use dashes, spaces, pipes (the '|' symbol), and anything other charactor to make it look exactly as you want. You don't have to draw the full box for a timer - --(T4:0 7sec)- will do nicely.

When you're done - Preview Reply, just to check it out.

If you don't use the vBcodes, anything over two consecutive spaces gets reduced to one, and your post looks like -- not good.)
 
Timer

You say you got one timer?
You got one PB.
Time when pressed?
Time when not pressed?
Someone mentioned MOV instructions?
Was one of the times Equal to 7sec? when pb pressed?
Was the other time Equal to 5 sec.? when pb not pressed?

It went something like that anyway, HUM, gotta scratch-n-think on this one. Hummmmmmm! :unsure:
 
I got this in a private message from c.s.barnett.

We like to keep all correspondence on the board C.S. so that everyone can benefit from it.

Why one timer
It is a question on a test for a class that I am taking in college. It's a take home test that we are able to use any source of information to get the answers. I did not set anything in the preset for the timer, but I have to move source N7:1 (4sec) to Destination to T4:0.PRE for one and N7:2 (7sec) to DES T4:0.PRE. I just want to make sure that I have done it right.

First off, make sure you read Allens post because he pretty much summed up why we aren't just posting the answer for you.

Second, If you have a plc at your disposal to test stuff on then do so, that is the best way to figure things out. I have one sitting on my desk at all times for such occasions when I am trying something new, it is the only way to be sure if something will work. I'm sure the same goes for most of the guys on this board who work with PLC's on a daily basis.

If you don't have a PLC to test it on then write out how you think it should work and post it here, then we will give you some help if you are still having problems.

Good Luck.
 
Timers again

That is right, if you have a PLC at your disposal, try it. If it works, then it's right. May not be the same as some of us would suggest but if it works, it works. :)

Use that PLC to verify your thinking.
 
Ooooooh, Roger....

Your answer made me think of those idiots at the cash register that don't know how to count change back after a purchase.

They think that the computer said this, so it must be right! Then they assume that they have pulled the correct change from the drawer... then they neatly stack the coins on the paper and hand it all to you! As in, "Don't worry, I gave you what the computer said you should have gotten!"

Seeing the idiot-light come ON, does NOT mean that the code is correct! Ever hear of two-wrongs-making-a-right?

And what about the "Spaghetti-Factor"?
 
Closure

I received this via Private Message:

c.s.barnett wrote on Today 07:00 PM:
You were wright, I thought it over and went to school and put it in and it only took me about 2 minutes to trouble shoot it.

Congratulations! And this is the OTHER reason we usually don't give out answers - with a little push, they figure it out on their own.
 
Idiots

An idiot I am not, I am sure that you can write a ladder that would work under the described condidtions then I can write a diffirent version that would work just as well. If one isn't born with all the knowledge of how a PLC works one will need to experiment to see if their way of thinking is correct.
It is you that are the idiot if you think there is only one way to get a correct result from a PLC. I will bet you anything you want to bet that I can write a ladder that is equal to anything you can write, so whos ladder is right? If the PLC works the problem the way that seems logical to you then you would be an idiot to reject it, why would you reject it. If you did that you would never get a program written, somewhere along the line you are going to need to say, "if the machine says so then that is it".
If the IDIOT at the fast food restraunt does the math in their head and the change at the register matches with their thinking, where is the idiot? If a child is learning math and they double check their homework with a calculator, where is the Idiot? If a person is learning to write Ladder with a PLC and they put it in the RUN/TEST mode to test their thinking, where is the idiot? I contend if you,Terry, have never written a program then put it in the RUN/TEST mode to verify your line of thinking, then I know where the idiot is. So what do you do if the program works? You will probably say " the machine says so so I will delete that program and write another because I'm no idiot". I don't think so. :nodi:
 
I think Terry was making the point about you saying 'if it works, it works'

This is not a good philosophy for programming. Sooner or later that attitude will bite yer.

Maybe not today or tommorrow but in three years time when you have to debug your own code, and can't - then it will bite yer.

There are many ways to do everything with plc's and two peoples code for the same task would not look the same. But that is different to 'if it works, it works'
 
Roger:

First off, Terry didn't call you an idiot. He said that you comment reminded him of idiots. A little thicker skin please.

Second off, code that works is not necessarily good code (which is Terry's point). The simpllest example I can think of are the following two motor starter rungs:

Example A:

START STOP MOTOR
---| |----+----|/|----( )-
|
MOTOR |
---| |----+



Example B:

START MOTOR
----| |----------(L)

STOP MOTOR
----| |----------(U)


.

Both work. Both start the motor when the Start is pushed and stop the motor when the Stop is pushed.

BUT...

In a power failure with the motor running, Example A will turn the motor off when the power is restored. Example B will turn the motor ON when the power is restored. The guy cleaning around the motor DIES if example B is used.

In a similar vein, the Motor Stop PB should be wired NC, and the logic in A should be --|/|--, so that if a wire breaks on the Stop circuit, the motor will stop. In the examples as they are written, it is possible to have a "runnaway train". Dangerous.

And as Terry has pointed out, there is the "spagetti factor". If I was feeling clever, I could take 10 rungs to perform the same function as Example A, adding one-shot bits and other things that wouldn't improve the code (as opposed to adding a debounce timer on the Start PB, which would be an improvement.)

If the IDIOT at the fast food restraunt does the math in their head and the change at the register matches with their thinking, where is the idiot?

Terry's point is that they don't do the math in their head, but believe the cash register blindly. It takes quite a bit of agrument to PROVE to them that they are giving you the incorrect change. Just as I am having to argue with you that not all ladder logic is created equal, (or rather, some are more equal than others).

As I'm sure you know, it's not the things that we code for that bite us, it's the things we DON'T code for that causes us grief.
 
Roger, you said...

If it works, then it's right.

Your "leap of faith" in the result is logically questionable.


To illustrate...

If All School Buses are Vehicles...
And All School Buses are Yellow...
Does that mean that All Yellow Vehicles are School Buses?

That illustration is the foundation of Logical Thinking.

If it works, then it's right.

If this code is written Correctly it will "Run"
If this code is written Correctly it will Turn ON light-A

If you then see Light-A ON while the code is Running, does that mean that the code is correct?

The answer is No. Seeing the Light ON while the code is running says nothing about the correctness of the code!

It doesn't matter if it's your flavor of "correct code" or my flavor of "correct code". The answer is still a resounding NO!

Again, this is THE fundamental premise of Logical Thinking.

It appears to be such a little nit-picky sorta thing... I assure you, it is not... it is EVERYTHING!
 
Band wagon

To compare my statement to an idiot is to infer that I’m an idiot as well. That choice of words was not mine but Terry’s, defend it if you will.
First of all I was not talking about someone that is versed in PLCs. Secondly when does a beginner say ok its working? Don't get so blind in defending Terry that you forget about the people who are just getting started in PLCs. Despite what you say, when you are first learning to program PLCs and you want to test your thinking to see if you are grasping the idea, if it works, it works and that is a good feeling and that will lead you down the right path. After a bit you will learn to improve.
So you can take ten rungs of program and reduce it to five rungs, big deal, I'll bet I can take any PLC program that any of you have written and make it shorter or better. How many of you have ever programmed and had a feeling it could be better but had to let it go as is, while it worked just fine it could have been a little better. Probably none huh? If I can take just one program that any one of you have ever written and make it better doesn't that mean you let it go without it being the best? My point is at some point you will all say if it works it works, whether you ran out of time or you ran out of brains, when you have done your best you are done. One should not blindly follow anyone or any thought, if you got a brain use it.
I am not going to beat a dead horse but I will stand by my statement in the light that it was given, for beginners with experimental programs, trying to get a grasp. Make of it what you will.
I should not have to devolope a thicker skin to cover for anothers insults.
 
Timers again

Allen

(Just as I am having to argue with you that not all ladder logic is created equal, (or rather, some are more equal than others).

You have no argument with me about ladder logic or any other subject.

I never said if it works it is good programming.

Please read my statement and try to put it in the context that it was meant to be.
I have seen programming that was so bad it made me shiver but it still worked and the person that did the programming thought it was great. He was looking at his program through his standard and I was looking at his program through my standard, which is right? Everyone needs to learn and everyone must say if it works, it works at some point. The ability to create a shorter program, a more logical program and how to avoid other unintended problems will come with experience. I for one have never had a program leave my desk that I thought was as good as it could be, I have never been satisfied, but still those programs are out there working.
Try to understand what I was trying to say when I said if it works, it works.
Just so you know, I am very critical of programmers and programming methods, it is hard to imagine anyone being more critical than myself but still I try to understand beginners and give them encouragement.
 

Similar Topics

I've got to scan a bar-code using a Cognex DataMan scanner. For reasons of convenience (my convenience!), I want to run the complete data...
Replies
7
Views
3,484
To help with commissioning the system, I've got a Test-screen which allows me to switch all the relays etc. on and off. When the Test-screen is...
Replies
5
Views
1,820
I'm writing some alterations to an FPWin program and need to see the running value of timers so I can set them correctly. It's my first time with...
Replies
0
Views
117
Hi everyone I am using Winproladder software for programming FATEK FBs PLCs and in programming, we often use Timers for activation of the...
Replies
4
Views
474
Hi all, I have what is likely not a complex issue, but I am working in Automation Studio and want an accumulating/retentive timer when a...
Replies
17
Views
1,829
Back
Top Bottom