Sign in to follow this  
Followers 0
Dennisc

Traffic Light

13 posts in this topic

Hello I was wandering if anybody could help me out with this traffic light program. I've tried but for some reason its not working right, it has to be done by comparison statements. If anyone could look at it and tell me whats wrong with it I would greatly appreciate it. This is my first project with comparison statements and I'm totally lost. I'm trying to include the instructions as well as an attached picture of what I've done so far. Thanks DennisC

Share this post


Link to post
Share on other sites
First advice: Before you screenshot your logic, narrow the window to the point just before it makes rung-wrap occur. Then it will be SO much more readable. EDIT: Judging by the uneven lines, it wasn't a screenshot, what did you do, print and scan it? Next time try ALT+PrtScrn, then open MSPaint, and type CTRL+V. Paul Edited by OkiePC

Share this post


Link to post
Share on other sites
You have a duplicate output address. The last one always wins (controls the output). Put the two conditions for the output on parallel branches to that output by itself, and put the other output on its own rung with the correct compare instructions preceding it. There are two examples of this mistake in your program. One is highlighted here in in my mspainted mark up of your jpeg. PiEaCe Edited by OkiePC

Share this post


Link to post
Share on other sites
Thanks alot for the help, and yes thats exactly what I done - printed it then scanned it. I tried taking a screenshot and pasting it. I just couldn't figure out how to get the entire thing on one page. Thanks for the suggestions, the traffic light works now, but I can't figure out how to work out the intial 5 seconds delay that both Red lights have when you first intially hit the button to start the program. Traffic_Light___word.doc Edited by Dennisc

Share this post


Link to post
Share on other sites
Yes, try narrowing the RSLogix window pane before using ALT+PrtScrn. Then paste in Paint, and save as JPEG. Crop it there, and save again with no whitespace in the filename. Yours would need two screenshots, but as a JPEG it will display inline with the post. The narrower the better for appearance, then add to your post. Maybe the word doc is a better approach, but narrowing the logix window first makes it much easier on my old eyes. I don't see anythig wrong with the code. The timer should reset and start both red lights for 5 seconds every time you restart via B3/1. When it is off the TON timer will reset the ACC t zero. When timing resumes, it should work just like you expect. Monitor the T4 timer while online and operate the PBs. Screenshot that if you can. . . EDIT: Also, are you downloading the program everytime, and it starts with a 180 ACCumulator and a 1 in B3/1? The pre-scan should drop out B3/1 I think. . .Hmmm. . .try popping a zero in those addresses, save the file, and then download it, go online and watch. . . EDIT AGAIN: No, I think the B3/1 address would not be cleared on prescan, and if both switch inputs are true it may not matter. CRS. What processor are you using? Edited by OkiePC

Share this post


Link to post
Share on other sites
Just want to tell you a tip: take a look to LIM instruction. GRT t4:0.acc 50 LES t4:0.acc 350 can be replaced by LIM 50 T4:0.acc 350 you logic is good but I think LIM instruction is more visual

Share this post


Link to post
Share on other sites
Thanks alot for all the information! I've learned alot quick. I'm at work right now and don't have a chance to troubleshoot the program again. The problem I am having with the program now is every time the TON resets it turns on the N/S & E/W Red lights for 5 seconds. It is only supposed to do this the first intial time you start the program, not every time the traffic light goes through its sequence. Thanks Alot! Dennis

Share this post


Link to post
Share on other sites
You should add a start timer. Add rung below rung 000 (b3:0/1 coil) xic b3:0/1 ton t4:1 .01 50 After that replace all b3:0/1 contact by T4:1.DN contact (expect the one we just added) Reajdust you LIM test value, now t4:0 is your normal run timer and t4:1 is your start delay. I think it's the best way

Share this post


Link to post
Share on other sites
Thanks for the info. I had thought earlier of adding another timer, but our instructor said we would only be allowed one master timer in the program and it would all have to be done by comparison statements. Then again, maybe I just misunderstood him. Thanks alot. Dennis

Share this post


Link to post
Share on other sites
You should take a look around move instruction. Something like t4:0.dn mov 50 t4:0.acc with this instruction you'll jump the first start sequence

Share this post


Link to post
Share on other sites
I still haven't figured this one out yet. I can get the program to run fine, but the problem is that every time T4:0 is done it resets to zero. This causes both red lights to come on at the same time for 5 seconds. This should only be done the first intial time the scans starts. I'm supposed to do this all with comparison statements but haven't been able to sucessfully do this. The move command sounds nice but I can't figure it out either. I can't get the jmp to work either, its seems like I'm really limited on this because the red lights have to be ran parallel. If anybody else has any ideas I would greatly appreciate it. Thanks Dennis Edited by Dennisc

Share this post


Link to post
Share on other sites
Try these two changes together and see if it fixes things. 1. Change T4:0 from a value of 650 to a value of 1000. 2. Add a rung at the end with GRT T4:0 650 MOV 50 T4:0.ACC. THis should reset your tiemr to 50 rather than 0 each cycle and avoid the double reds you don't want.

Share this post


Link to post
Share on other sites
Thanks very much for the help. I apologize for being stupid, but I guess the problem is I cant follow instruction #2. "Add a rung at the end with GRT T4:0 650 MOV 50 T4:0.ACC." I can add a rung, no problem, but then do I use a greater with T4:0 as Source and 650 as Source B? Then a move command at the end of the rung with Source as MOV 50 and Source B as T4:0.ACC? Thanks again for the help. Dennis. Edited by Dennisc

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