Jump to content
galluccinator

Beginner Ladder Programming Question

Recommended Posts

Hello,

 

I am new to ladder logic and the Unitronics system, and I had two questions:

 

1) Is there any way to simulate a project WITHOUT connecting the PLC controller to it? I want to see how some of the example projects run but I don't have the actual console yet.

 

2) How would I make the program wait for a specific condition to be met before moving on with the code? For example, I want to open a valve, and then once the pressure goes down to a certain level, shut off the valve. However, if I use a positive contact saying "If pressure is <= x" and then write a coil that shuts the valve, won't the program just skip the rung (because in the beginning it would just evaluate as false) and end the program without waiting for the condition to be fulfilled?

 

Thank you in advance!

Share this post


Link to post
Share on other sites

Currently, there  isn't any simulator.

Visilogic and the Vision PLCs do have a 3rd party simulator.

The PLC works in scans. On each scan, the code runs from the main function, and continues to each function or code that is being called.

Lets say that for example, the scan time (the time it takes for your ladder code to run from start to end) is 1ms... then it means that every 1ms, the "if pressure <= x then" would be evaluated.

(So threre is no problem)

Share this post


Link to post
Share on other sites

The trick here is to write your program in steps using MB as flags.

step1 = NOT step2 then set step1 flag (turn on valve output)

step2 = NOT step3 and step1 and low pressure set step2 flag (turn off valve) 

Each network should start with a NOT contact of the next flag

 plus an AND of the previous flag, thus blocking an unwanted sequence.

Make a program routine just for the steps

Make an output routine which ties the flags to the outputs.

Make a reset routine to clear all the flags.

:)

Share this post


Link to post
Share on other sites

You can perform a comparison "pressure >= X", and if True then make a Return Call. No lower rungs in the ladder will be executed unless the pressure falls below X.

Share this post


Link to post
Share on other sites

Hello,

 

I am new to ladder logic and the Unitronics system, and I had two questions:

 

1) Is there any way to simulate a project WITHOUT connecting the PLC controller to it? I want to see how some of the example projects run but I don't have the actual console yet.

 

2) How would I make the program wait for a specific condition to be met before moving on with the code? For example, I want to open a valve, and then once the pressure goes down to a certain level, shut off the valve. However, if I use a positive contact saying "If pressure is <= x" and then write a coil that shuts the valve, won't the program just skip the rung (because in the beginning it would just evaluate as false) and end the program without waiting for the condition to be fulfilled?

 

Thank you in advance!

 

It's important to understand the PLC workflow. Here are the basics:

 

1) Read inputs.

2) Evaluate ladder logic.

3) Write outputs.

4) Repeat steps 1-3 continuously.

 

Normal software is linear and runs from beginning to end. PLC software is a loop - it executes and repeats infinitely. You cannot have the program stop and wait - it will create a watchdog timer alarm.

 

The important thing to remember is that each Output Coil should exist in only one ladder rung. Think out every condition that turns the output on and place it in a single rung. (The exception is SET & RESET coils)

If you need to wait for a condition to be true before executing code, set a bit to be true when that condition exists and use it as a gate for that logic or subroutine.

Use the Main Routine to execute subroutines and execute initial (startup) actions only. All program logic should take place in subroutines.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...