Beginner Help Please!

zkocher

Member
Join Date
May 2017
Location
Detroit
Posts
2
Hello,

I am new to this site and also new to PLC programming.

I want to create a PLC program in RS Logix5000 that will do the following...
When a button is pressed and released once there is a light turned on.
When the button is pressed and released a second time the output is turned off.
When the button is pressed a 3rd time the light turns on again.

I know this seems extremely simple but I can not seem how to program it in ladder logic.

Thanks
 
I apologise because l just re read your post.( so l was going to help, but l now see you don't need help in coding, lucky for me, as l lack the art myself. So in C++ you just put your code into what ever PLC you want to use and it will convert it if you have paid the $10,000 they want for the software).
Or did you mean maybe you would like help in any sort of coding, otherwise do it in ST or Ardunio
You are right it is extremely simple, so everyone must be able to do.
but if it is a school work we will gladly do it for you.
What pass mark would you deem suitable.
Please keep in mind that if l write the program and you put it forward, then they take you away in the police car because it will ( l mean, hopefully it won't have have a dangerous mistake, it';s not MY fault).
But if you attempt to do some coding yourself of your home work, even sceptics like me might help.
So l suggest, have a read of some basic PLC, then work out what PLC you are going to use, supply JUST an attempt and people will help.
But l think if you put that bit of effort in, you will relies, ha this is interesting and want to work it out yourself for great personal satisfaction, best feeling you will get, apart from stroking it to fast, actually theirs lots of them, fast cars, fast drinking, even better slow yachts (l have one of them).
See you at the library
kevin
 
Last edited:
Search the forum for "flip flop" There are no less than 18 different ways to do this. Some are simple, elegant and obscure, others are a little more wordy and easier to follow.

I have two methods I use. One of them is to simply tie the input to a counter and reference the least significant bit of the counter which will toggle off and on each time the counter operates. Since the counter operates on a rising edge, it will only advance once each time the button is pressed. This is as simple as it gets, but can be obscure if someone doesn't understand why you are referencing bit zero of a counter accumulator value.

The other method I use involves oneshot instructions and latch and unlatch instructions along with another bit to prevent both the latch and unlatch from happening on one press.

This question comes up a lot...here's a link to the most recent thread on this topic that I have seen:

http://www.plctalk.net/qanda/showthread.php?t=109639

In post #2 of that thread, I link to an older post which has many examples graciously compiled by long time (now retired) member Lancie.
 
graciously compiled by long time (now retired) member Lancie.[/QUOTE]

l hope he is sniffing around with another name.
Thanks for guidance Lance01
Kevin
 
Hello,

I am new to this site and also new to PLC programming.

I want to create a PLC program in RS Logix5000 that will do the following...
When a button is pressed and released once there is a light turned on.
When the button is pressed and released a second time the output is turned off.
When the button is pressed a 3rd time the light turns on again.

I know this seems extremely simple but I can not seem how to program it in ladder logic.

Thanks

You could do something like this:

Code:
L : Lamp Output
B : Button

| | - XIC (Normally Open)
|/| - XIF (Normally Closed)
(U) - OTU (Output UnLatch)
(L) - OTL (Output Latch)





S:FS L
0: --| |----------(U)-


B L L
1: -| |-|--|/|-----(L)-
|
| L L
|--| |-----(U)-



Basically what is going on here, is on the first scan (S:FS), the lamp output is unlatched, so it doesn't turn on when you first run the program.

Then it tests for button input, and if the lamp coil is energized, it unlatches it, and if it is not, it latches it.

Good luck with your ladder logic adventure.
 
You could do something like this:

Code:
L : Lamp Output
B : Button

| | - XIC (Normally Open)
|/| - XIF (Normally Closed)
(U) - OTU (Output UnLatch)
(L) - OTL (Output Latch)






S:FS L
0: --| |----------(U)-


B L L
1: -| |-|--|/|-----(L)-
|
| L L
|--| |-----(U)-



Basically what is going on here, is on the first scan (S:FS), the lamp output is unlatched, so it doesn't turn on when you first run the program.

Then it tests for button input, and if the lamp coil is energized, it unlatches it, and if it is not, it latches it.

Good luck with your ladder logic adventure.

Basically what is going on here is that the logic will not work !

When that rung is scanned with the button input true, and the latched bit false, the top branch will latch the output bit on. Then the bottom branch is executed, which sees the latched bit on (from the upper branch), and immediately unlatches it. Furthermore, the output bit will be toggling on and immediately off again for as long as the button is held down.

It is clear you haven't tested, or even used, this method to toggle a bit. May I politely suggest you do not post untried and untested code, as it could be misleading to inexperienced people, who come here to get good advice.
 
May I politely suggest you do not post untried and untested code, as it could be misleading to inexperienced people, who come here to get good advice.

Of course you may, and thank you for pointing out my mistake. Attached is a working, tested example of how to solve this problem.

I suppose it's better to do the real thing, than mess around in a reply box.

Edit: Of course, this is not the only way of doing it. Just one.

Capture.jpg
 
Last edited:
Thanks and Old Tries!

Hey guys!
Really appreciate your help. Sorry didnt respond sooner but I was sick this weekend and had to do some travelling too unfortunately

Just graduated uni and need some confidence on this stuff because I am trying to switch my brain from Nano.Eng to Controls.Eng.

Attached is my previous 2 examples.
I knew I was close a billion times but I kept jumping around the answer.
I will try to update the 2 to make both of them work.

I have reviewed the posts and have updated mine as well.

Thanks again!
Once I wrap my head around some other tests for myself I will feel confident to help other people as well. I have some other things I want to try and program as well.

Example 1: Count # of times input was pressed. If pressed odd amount of times turn on light, if pressed even amount of times turn off light. I am still working on how to properly use the counting instruction for this one, but I believe the logic is still sound.
Example 2: Use logic to toggle the light. THIS ONE WAS GIVING MY BRAIN A HARD TIME TO ADJUST!

Thanks!!
 
Example 1: Count # of times input was pressed. If pressed odd amount of times turn on light, if pressed even amount of times turn off light. I am still working on how to properly use the counting instruction for this one, but I believe the logic is still sound.

You pretty much don't need to "use" the counter as a counter at all (for the toggle function, that is)..... The only bit you need to inspect is bit 0 of the accumulator, that goes on and off alternately each time the counter is "enabled". bit 0 has a binary weighting of 1, so when the count is even, the bit is off, and when it's odd, the bit is on. On Allen-Bradley counters you don't have to worry about overflow, rollover, done, or anything, bit 0 just keeps on toggling, forever !



Example 2: Use logic to toggle the light. THIS ONE WAS GIVING MY BRAIN A HARD TIME TO ADJUST!

Yep, that's the hard way... Many of the so-called "solutions" that keep cropping up don't take into account what happens when the power goes off, or the processor is restarted. I strongly hold the view that a toggled bit should return in the same state, and if the application says it should be reset on power-up, then put code in to do so.
 

Similar Topics

I'm event AV Technician (Sound, Projection, and Lighting). Over the last couple of years I've used a Weigl ProCommander PHX to control some event...
Replies
9
Views
2,689
I'm an electrician and I started to learn programming. My dream is to start programming for Siemens. I spoke with a company more about a job and...
Replies
17
Views
4,715
Hello everyone, I'm really interested in playing with PLCs, i'm thinking of picking up a TECO GENIE II SG2, its relatively inexpensive. As for the...
Replies
14
Views
3,442
a/ Input – X0 -> turns Output – y0, y5 Input X1 –turns OFF y5, but y0 stays ON b/ Input X0 -> turns Internal Bit M10 and Output Y0 M10 ->...
Replies
14
Views
3,310
hey everyone, i am doinga project and wondering whether plc's are the riight thing to use and if so how difficult it would be to do. i will have...
Replies
9
Views
2,713
Back
Top Bottom