Sign in to follow this  
Followers 0
AlThePal

Convert this flowchart to ladder logic

7 posts in this topic

I have produced the specification for part of a job using a flowchart which I've attached as a pdf. I now have to convert this to ladder logic (in a ControlLogix) and am suffering brain fade! Any pointers? (As an aside, can anyone tell me how to upload images so I can embed the flowchart in this post?) Flow_chart.pdf

Share this post


Link to post
Share on other sites
Check out the help file for the FOR Instruction. A FOR - NEXT Loop will do this trick.

Share this post


Link to post
Share on other sites
Loops are slick, but in ladder the 20 alarms would be simple inline permissives in a rung. Start Stop Alarm1 Alarm2 Alarm3 Alarm4 Alarm5 Output ---] [---]/[------]/[-----]/[-----]/[-------]/[------]/[-------( )---- Yes, it looks like a pain in the butt, but ladder will process it with with more efficiency that it will process the a loop, and when you get down to it, its faster to program than stewing over how to do a loop. And when Bubba from maintenance wants to observe why the output won't turn on he can see exactly which bit is giving him problems in a simple and easy to understand way, and that means he is not calling you at 3:00 in the morning. If all of the alarms are in a single DINT then you can use a comparrison EQU or masked comparrison MEQ instruction to see if the word's value (or part of the word) is 0, meaning no bits are set. Edited by Alaric

Share this post


Link to post
Share on other sites
alaric is absolutely right, normal way is to to use bits within same DINT so your code would look like this: input1 output1 output1 ---| |---------|/|----------[equ alarms 0]-------------(L) but you can remove the NC (doesn't do anything): input1 output1 ---| |--------------[equ alarms 0]-------------(L) i used latch since this is how i translated your sample.

Share this post


Link to post
Share on other sites
Guys, Thanks for your help. I finally managed to work out how to do this using 'state' variables to track which bit of code I should be running (I'd simplified things a bit for the example). I had no sooner done this than the thought of Bubba phoning at 3am prompted me to do it the simple way! As Alaric and panic mode both suggested, I'm going to set bits for the results of each check in a DINT and look for a known value at the end of the checks. This also lets me use these bits as alarms to an HMI. I've done a reasonable amount of PLC coding before, but this is the first time I have produced the specification in a flowchart format. I have to say that I thought it would be easier to translate from flowchart to ladder, but it seems not. Any help with uploading images so I can display them in posts?

Share this post


Link to post
Share on other sites
I wonder do you have any suggestion about my pdf conversion process?

Share this post


Link to post
Share on other sites
I suggest writing your logic in a State Machine format...State 10 - Input 1 On/Off; Yes - Go to State 20; State 20 - zero i (one-shot CLR register i) and go to State 30; State 30, increment i (one-shot CTU). With State Machine format, it is easy to add an intermediate state, and when you trend your STATE tag, you can easily see where the program hung up or did not transition properly. At a previous OEM machine builder, ALL of our systems first started with a concise flowchart and then was converted into ladder logic. The flowchart was always updated to match the program code, so that any issues first required you to pull the flowchart and figure out how your code jumped out of the flow (or was there not an alternate branch at some point).

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