Basic program (beginner)

sunshine

Member
Join Date
Apr 2004
Posts
3
I'm at a loss as to how to do this. What is it that confuses me? :(

There are four input sensors to an annunciator system that switch on if some operational malfunction occurs.
Design a program that operates the alarm system as follows:

- if any one input is on nothing happens.
- If any two inputs are on a green light goes on.
- if any three inputs are on a yellow light goes on.
- if all four inputs are on a red light goes on.
 
hi sunshine,
First try looking at this as a lesson in logical reasoning...not programming. As Doug said, make truth tables to show the states of your inputs. Then apply the logical reasoning...IF X1=1, AND X2=1, AND X3 NOT=1, AND X4 NOT=1, THEN O1=1. There, the first line of logic is done. It really is fun.

Waggs



Due to economic reasons, the light at the end of the tunnel has been shut off.
 
BTW,

I just completed the problem for the hell of it.
It took me 5 minutes in total to complete.

This was an easy homework problem.

Doug
 
Prompt:

Truth Table
Inputs Outputs

A B C D__G Y R
0 0 0 0__0 0 0
0 0 0 1__0 0 0
0 0 1 0__0 0 0
0 0 1 1__1 0 0

Please fill in the rest.

Doug
 
Don't try and look at all the inputs at once, it will only confuse the issue. Take it one 'bit' at a time and you will see it fall into place. Doug's truth table will help you alot to see it.

Waggs

Due to economic reasons, the light at the end of the tunnel has been shut off.
 
Prompt:

Truth Table
Inputs Outputs

A B C D__G Y R
0 0 0 0__0 0 0
0 0 0 1__0 0 0
0 0 1 0__0 0 0
0 0 1 1__1 0 0

Doug_Adam`s Table with a little Help

----A-----B-----C-----D------------------GRN
Part of rung 1
---] [----] [----]\[----]\[------------------( )--
------------------------------- |
------------------------------- |
---] [----]\[----] [----]\[-----|
------------------------------- |
------------------------------- |
---]\[----] [----] [----]\[-----|
------------------------------- |
------------------------------- |
---] [----]\[----]\[----] [-----|

Doug_Adam I had never seen this done before. I think you`ve
helped me as much as Sunshine.
Ya`ll have a nice day
Tom
 
As for most beginners and a whole bunch of professionals, your first mistake is to start thinking about the INPUTS.

Forget the inputs, and start off with the OUTPUTS. There are always a lot fewer outputs, and the outputs are your GOAL, the final product, the place you are trying to get to. If you do not have a clear picture of the OUTPUTS, then you will have trouble with the program.

So for any PLC program:

(1) Make a list of your Outputs.

(2) Enter a rung for each Output, leaving the input space blank for now. Put in the PLC address for the output, and add a comment that will tell you what the output does. Also add a rung comment that describes the rung in your own words. If you can describe it, you are 80% done.

(3) Go back to the FIRST Output, and think about what combination of parallel/series Input(s) are needed to turn it OFF. If you can't turn it OFF, then don't ever turn it ON! Put in these OFF Inputs and document each one.

(4) Now think about what combination of parallel/series Input(s) are needed to turn this output ON, and combine those with the OFF inputs. (Hint: Many times the ON input is the same as the OFF input). Document or add comments for each instruction.

(5) Repeat steps 1-4 for each Output.

(6) Download to the PLC and test.

There you have 6 easy proven steps that will allow a beginner to write any PLC program!
 
Last edited:
To Thomas,
Glad to be of help.

To Lancie1,
Just out of interest, how do you handle sequences?

Although sequences are not required for this problem, you indicated else where that this is your general programming method.

Just curious.

Doug
 
Doug,

You say that I indicated that sequences is my general programming method? I don't remember that! Perhaps you have confused me with someone else?

In fact, I don't remember ever using a Sequencer in a PLC program. I have found that in the real world, there are so many inputs that affect the Outputs, that a Sequencer is not very practical to use in the typical industrial PLC program. Sequencers (rotary switches, cams, drum switches) are generally used on small appliances, where there are few additional inputs to consider AFTER the timing sequence has been started. For almost everything else in the industrial plant world, you have to continually look at various input switches, limits, settings, etc, so that it becomes inefficient to used a fixed set of outputs controlled only by the Sequencer timer.

While we are talking about logic methods, there has been considerable discussion on this site about using Truth Tables, Karnaugh maps, and Boolen math to minimize the PLC ladder logic. This is an admirable goal, but just one warning: Once on a call "in the field" at a plant site to troubleshoot a problem, not having the original file folder containing the logic minimization routines, I had difficulty following the logic, because I was looking at the MINIMUM logic, and I could not make the leap between "understandable" and "minimum". The logic mimimum is great for the PLC, but maybe not so great for us humans that have to figure it out on the spur of the moment :(
 
Lancie1 said:
...a Sequencer is not very practical to use in the typical industrial PLC program.

And are a huge pain in the arse when it gets out of step. Can't stand the stupid things. Why we let vendors bring that junk in here is beyond me. One limit switch failure and you are picking pieces up off of the ground. Grrrrr....



While we are talking about logic methods, there has been considerable discussion on this site about using Truth Tables, Karnaugh maps, and Boolen math to minimize the PLC ladder logic.

As an aside, Sunshine should look into getting a copy of "Bebop to the Boolean Boogie" Great book.



This is an admirable goal, but just one warning: Once on a call "in the field" at a plant site to troubleshoot a problem, not having the original file folder containing the logic minimization routines, I had difficulty following the logic, because I was looking at the MINIMUM logic, and I could not make the leap between "understandable" and "minimum". The logic mimimum is great for the PLC, but maybe not so great for us humans that have to figure it out on the spur of the moment :(

Like I tell the guys, we've never recieved a rebate for the memory that we haven't used (in the PLC). And as for scantimes, the GE stuff that we use (90/30's, Series Sixes) are blazingly fast. Speedy little devils.


John
 
Sequencers Bad?

The problem I have with sequencers is not the sequencer itself. I find in to many cases you get some one in there who is a hack, and just hacks and slashes to a solution. 99% of the time after commissioning is complete the problem with the program is not the program. It is the hardware. That is what maintenance is for, fixing the problem. Not putting a bandage on it, forgetting about it, and then adding more bandages.


Sorry just venting there.
 

Similar Topics

Hello I am new here and new to PLC's, I wrote this program for a class that I am taking and my local tech school. The description is switch 7 will...
Replies
0
Views
404
Hello I am new here and new to PLC's, I wrote this program for a class that I am taking and my local tech school. The description is switch 7 will...
Replies
10
Views
1,957
Hi all I have a SLC 5/04 with a BAS module sending print data to a dot matrix printer. In the Basic program in this module, there are what...
Replies
4
Views
1,912
Hey, I've just started working with a PLC (got it second-hand) and I'm just trying to make a very simple program to use a push button to turn on...
Replies
11
Views
3,290
My work has many Windows 7 touch screen PC as HMI for machine control. The HMI program is written in Visual Basic using ClickOnce Application. I...
Replies
21
Views
10,771
Back
Top Bottom