[Home]Classicladder Ver 7.100

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

No diff available--this is the first major revision. (no other diffs)

ClassicLadder

See also Sample HAL And ClassicLadder
1. Documentation for classicladder ver 0.7.100
2. Loading the classicladder user module
3. Loading the classicladder realtime module
4. The realtime module exports HAL pins
5. The Classicladder GUI
6. Ladder objects
6.1. CONTACTS
6.2. TIMERS
6.3. MONOSTABLES
6.4. COUNTERS
6.5. COMPARE
6.6. OPERATE
6.7. COILS
7. The Variables
8. Using JUMP COILs
9. Using CALL COILs
10. GRAFCET ( Sequential ) programming
11. EMC 2.2 features
12. EMC 2.3 features
13. FAQ and Feature Requests
14. BUGS
15. Cradeks Classicladder Cheatsheet
16. Ladder samples


ClassicLadder is a type of programming language originally implemented on industrial PLC's (it's called LadderProgramming).
It is based on the concept of relay contacts and coils, and can be used to construct logic checks and functions in a manner that is familiar to many systems integrators.
It is important to know how ladder programs are evaluated when running:
        It seems natural that each line would be evaluated left to right then the next line down etc-but it doesn't work this way.
        For each (6 line) rung, ALL the inputs are read, ALL the logic is figured out, then ALL the outputs are set, then the next rung is evaluated etc.
        This can presents a problem in certain circumstance if the output of one line feeds the input of another 

Classicladder is the original work of Marc Le Douarain.
Classicladder version 0.7.100 is included in emc2.1 to EMC 2.2.8.

Some sample classicladder configurations are in src/hal/classicladder/projects_examples. You can run one of the examples with 'halrun example.hal'.

1. Documentation for classicladder ver 0.7.100

This page documents the features and workings of ClassicLadder ver 0.7.100 available from EMC 2.1.x to EMC 2.2.8
While specific to version 7.100 much of the info is relevant to later versions of CL.
EMC 2.3.x now uses ClassicLadder ver 7.124 please find info about it in the EMC2 manual / wiki page

This page is a little dated now (Feb 08) there are differences since EMC 2.2
mostly just little details different such as the sections display does not display a config button and there is a button to show/hide the variable window.

Loading options

First off lets talk about the options when loading Classicladder. If you were going to load classicladder without EMC you would start HAL in a terminal by typing:

 halrun 

and enter something like this:

loadrt threads name1=thread period1=1000000 
loadrt classicladder_rt                                                                          
addf classicladder.0.refresh thread
start
loadusr -w classicladder --nogui example.clp
loadusr -w classicladder

   If you were going to load classicladder with EMC you would use most of the same comands but they would be in a hal file.
This sets up a realtime thread (name1), loads classiclader realtime module, adds the classicladder function to the thread, starts the thread, loads and sets up the classicladder user module with no GUI which loads the ladder program example.clp, and finally loads classicladder user module with the GUI. It seems you must load the nogui first then load classicladder again to make it all work.
The -w is a loading option that tells HAL to wait for classicladder (or whatever program you are loading) to close before continuing with the next HAL command.
(which usually shuts down the realtime environment.) The other common one for Classicladder would be -W which tells HAL to wait till classicladder sends a signal it is ready for HAL to continue. This allows Classicladder to export HAL pins before HAL continues loading other modules that might need to see those pins.
You can not load filenames with spaces in them from the command line.

2. Loading the classicladder user module

 	     There are options while loading the user module:

Unfortunately as of EMC 2.1.x, --version and --help do not exit HAL properly. Really only --nogui is any use to you. Use the GUI when setting up your system then change it to --nogui when running. The only other thing you can do while loading the user module is specify a ladder program to load. ladder programs are specified by the .clp ending.

for examples:

 loadusr -w classicladder --nogui myladder.clp
loads the classicladder user module, ladder program myladder and displays nothing.
 loadusr -w classicladder myladder.clp
loads the classicladder user module, ladder program myladder and starts the classicladder GUI.
 loadusr -w classicladder
loads the classicladder user module, starts the GUI but loads no laddder program.

3. Loading the classicladder realtime module

It is possible to configure the number of each ladder object while loading the classicladder realtime module

ladder objectsVariable nameDefault number
rungs(numRungs) 100
Bits (numBits)500
Word variables(numWords)100
Timers(numTimers)10
Monostables(numMonostables)10
Counters(numCounters)10
Hal inputs bit pins(numPhysInputs?)50
Hal output bit pins(numPhysOutputs?)50
Arithmetic expressions(numArithmExpr?)50
Sections(numSections)10
Symbols(numSymbols)100
and as of EMC 2.2.0
Signed integers in pins(numS32in)0
Signed integers out pins(numS32out)0

If you do not configure the number of ladder objects classicladder will use the default values. Objects of most interest are numPhysInputs?, numPhysOutputs?,(and as of EMC ver 2.2.0) numS32in and numS32out.
Changing these numbers will change the number of HAL bit (and as of EMC ver 2.2.0) S32 pins available.

For example:

 loadrt classicladder_rt numRungs=12 numBits=100 numWords=10 numTimers=10 numMonostables=10 numCounters=10 numPhysInputs?=10 numPhysOutputs?=10 numArithmExpr?=100
numSections=4 numSymbols=200

4. The realtime module exports HAL pins

HAL bit in pins correspond to %I variables ( eg HAL pin name classicladder.0.in-00 is %I0)
HAL bit out pins correspond to %Q variables ( eg HAL pin name classicladder.0.out-00 is %Q0)

(as of EMC 2.2.0) The realtime module CAN export HAL s32 unsigned integer in/out pins, Values of this type can range from -2,147,483,648 to 2,147,483,647. They would correspond to some of the %W variables.
For instance if you requested 5 s32in pins and 5 s32out pins ( by adding numS32in=5 numS32out=5 after loadrt classicladder_rt)

%W0-%W4 would correspond to HAL pin name classicladder.0.s32in.00 -04
%W5-%W9 would be HAL pin name classicladder.0.s32out-00 -04 and
%W10-99 would be regular (memory) variables.

If you request only s32out pins they would start at %W0 and regular words would start after them.
so it maps %W variables like this. Number of s32in pins first (if any), then number of s32out pins second (if any) then regular memory variables.

5. The Classicladder GUI

If you load classicladder with the GUI it will display three windows: vars, section display, and section manager.

This is the vars window.
It displays some of the variable data and variable names. Notice all variable start with the % sign.
The three edit areas at the top allow you to select what 15 variable will be displayed in each column. For instance if there were 30 %I variable and you entered 10 at the top of the column,
variable %I10 to %I25 would be displayed.
The check boxes allow you to set and un set variables but when classicladder is running hal will update the pins and change them.

Near the bottom are the %W variables. These are called word variable and represent positive and negative (signed) numbers and are used with compare and operate. By clicking on the variable, you can edit the number to display which ever you want.The edit box beside it is the number stored in the variable -you can change it- and the drop-down box beside that allow you to choose whether the number to be displayed is in hex, decimal or binary.

The %I variable represents HAL input bit pins. The %Q represents the relay coil and HAL output bit pins. The %B represents an internal relay coil or internal contact
There is a quirk that the word variables list will not display the symbols unless the check-box in the section manager is checked and you miss-edit the corresponding variable. Meaning erase the numbers after the %W and press return-if there is a symbol for that number you erased and the display symbols check-box in the section display is checked it will show it.

Starting in EMC 2.2.0 the variable window is split into two windows
upload:vars.png

This is the Section Display window
It displays the ladder rungs (each rung is 6 lines wide)
Most of the buttons are self explanatory.
The config button is not used in EMC 2.2x.The symbols button will display an editable list of symbols for the variables (eg you can name the inputs, outputs, coils etc) The reset button resets something (not sure yet) The quit button will only shut down the display-the ladder program will still run in the back ground. The check box at the top right allows you to select whether variable names or symbol names are displayed

As of EMC 2.2.0 there is a button for opening/closing the variable windows.
upload:Section%20Display.png

This is the section manager
It allows you to name, create,or delete sections.
This is also how you name a subroutine section for call coils.
upload:Sections%20Manager.png

This is the LADDER editor window
Starting from the top left image:
SELECTOR ARROW, ERASER
N.O., N.C. , RISING-EDGE ,FALLING-EDGE CONTACTS.
HORIZONTAL, VERTICAL , HORIZONTAL RUNNING-CONNECTIONS
TIMER, MONOSTABLE, COUNTER, COMPARE
N.O. COIL, N.C. COIL, SET COIL, RESET COIL
JUMP COIL, CALL COIL, OPERATE
upload:Editor.png

Lets talk about the editor window buttons:

There is a serious bug that affects compare/operate functions. If you do not enter anything or miss spell the variable when entering it, the editor will cross info in two or more compare/operate ( needs two or more for this to happen). after which trying to edit one will change all. the only way to fix this is to clear the program (new) and try again or hand edit the saved file.
This is fixed as of EMC 2.2.0
Another bug is that you can not enter symbol names in compare/operate functions, though they wil be displayed with symbols in the section window- uncheck the DISPLAY SYMBOLS check-box when editing to help get around this.
This is fixed as of EMC 2.2.0
The MOY function has a bug. The second argument cannot be a number-must be a Variable. Marc tells me MOY is French for average.

There is actually some problems with (C)all (J)umps coils :
  - you should have only one (J)/(C) coil in each rung, else the others top (J)/(C) coils
    will not be taken into account.
  - if you've a Jump coil in the rung, the coils at the bottom of it are always refreshed even
    if the Jump coil is true (they shouldn't).

6. Ladder objects

6.1. CONTACTS

                     - Represent switches or relay contacts. They are controlled by the variable letter and number assigned to them. 
                       The variable letter can be B, I, or Q and the number can be up to a three digit number eg. %I2, %Q3, or %B123.
                       Variable I is controlled by a Hal input pin with a corresponding number. Variable B is for internal contacts, controlled by a B coil with a
                       corresponding number. Variable Q is controlled by a Q coil with a corresponding number. (like a relay with multiple contacts). 
                       Eg. if HAL pin classicladder.0.in-00 is true then %I0 N.O. contact would be on (closed, true, whatever you like to call it).
                           If %B7 coil is 'energized' (on, true, etc) then %B7 N.O. contact would be on.
                           If %Q1 coil is 'energized' then %Q1 N.O. contact would be on (and HAL pin classicladder.0.out-01 would be true.)

                     - N.O. CONTACTS           - (Normally Open switches.) When the variable is false the switch is off
                     - N.C. CONTACTS           - (Normally Closed.) When the variable is false the switch is on
                     - RISING EDGE CONTACTS    - When the variable changes from false to true, the switch is PULSED on.
                     - FALLING EDGE CONTACTS   - When the variable changes from true to false, the switch is PULSED on.

6.2. TIMERS

                     - Represent count down timers!

                     - Timers have 3 contacts. E-for enable (input) D-for done (output) R-running (output)
                     - E (input)  -enable      -will start the timer when true. The timer count resets when the E input goes false.
                     - R (output) -running     -will be true will the count is running.
                     - D (output) -done        -will be true when the count is Done and will stay true till the input goes false.
                     - The timer base can be multiples of milliseconds, seconds, or minutes.

                     - There are also Variables for timers that can be read and/or written to in compare or operate blocks.
                      Txx.R : Timer xx running        (boolean, read only)
                      Txx.D : Timer xx done           (boolean, read only)
                      Txx.V : Timer xx current value  (integer, read only)
                      Txx.P : Timer xx preset         (integer, read or write)

6.3. MONOSTABLES

                      -Represent one-shot timer

                     - Monos have 2 contacts I and R.
                     - I (input)  -input       -will start the mono timer running.
                     - R (output) -running     -will be true while timer is running. 
                     - The I contact is rising edge sensitive meaning it starts the timer only when changing from false to true (or off to on).
                     - While the timer is running the I contact can change with no effect to the running timer.
                     - R will be true and stay true till the timer finishes counting to zero.
                     - The timer base can be multiples of milliseconds, seconds, or minutes.

                     - There are also Variables for monostables that can be read and/or written to in compare or operate blocks.
                      Mxx.R : Monostable xx running        (boolean, read only)
                      Mxx.V : Monostable xx current value  (integer, read only)
                      Mxx.P : Monostable xx preset         (integer, read or write)

6.4. COUNTERS

                     - Represent up/down counters.  

                     - There are 7 contacts: 
                     - R (input)  -reset       -will reset the count to 0.
                     - P (input)  -preset      -will set the count to the preset number assigned from the edit menu.
                     - U (input)  -up count    -will add one to the count.
                     - D (input)  -down count  -will subtract one from the count.
                     - E (output) -under flow  -will be true when the count rolls over from 0 to 9999.
                     - D (output) -done        -will be true when the count equals the preset.
                     - F (output) -overflow    -will be true when the count rolls over from 9999 to 0.
                     - The up and down count contacts are edge sensitive meaning they only count when the contact changes from false to true (or off to on if you rather).  
                     - The range is 0 to 9999. 

                     - There are also Variables for counters that can be read and/or written to in compare or operate blocks.
                      Cxx.D : Counter xx done             (boolean, read only)
                      Cxx.E : Counter xx empty overflow   (boolean, read only)
                      Cxx.F : Counter xx full overflow    (boolean, read only)
                      Cxx.V : Counter xx current value    (integer, read or write)
                      Cxx.P : Counter xx preset           (integer, read or write)

6.5. COMPARE

                     - for arithmetic comparison.      eg Is variable %XXX = to this number (or evaluated number)

                     - The compare block will be true when comparison is true. you can use most math symbols  +,-,*,/,=,<,>,<=,>=,(,),^ (exponent),% (modulus),& (and),| (or),! (not).
                     - You can also use math functions. They are ABS (absolute), MOY (average). eg ABS(%W2)=1, MOY(%W1,%W2)<3  MOY is French for average.
                     - You can use hexadecimal numbers by preceding the number with $  eg. %W1=$16
                     - There is a list of Variables down the page
                     - an example might be : %W1<2*%C0.V meaning: Is word variable #1 less then 2 times the current value of counter #0 ?

6.6. OPERATE

                     - For Arithmetic assignment.      eg assign this number (or evaluated number) to this variable %xxx
                     - You can use hexadecimal numbers by preceding the number with $  eg. %W1=$16

6.7. COILS

                     - represent relay coils. They are controlled by the variable letter and number assigned to them.
                     - The variable letter can be B or Q and the number can be up to a three digit number eg. %Q3, or %B123.
                     - Q coils control HAL out pins. eg if &Q15 is 'energized' then HAL pin classicladder.0.out-15 will be true.
                     - N.O. COIL               -(a relay coil.) When coil is 'energized' it"s N.O. contact will be closed (on, true, etc)
                     - N.C. COIL               -(a relay coil that inverses its contacts.) When coil is 'energized' it"s N.O. contact will be open (off, false, etc)
                     - SET COIL                -(a relay coil with latching contacts) When coil is 'energized' it's N.O. contact will be latched closed.
                     - RESET COIL              -(a relay coil with latching contacts) When coil is 'energized' It's N.0. contact will be latched open.
                       ***WARNING*** if you use a N.C. contact with a N.C. coil the logic will work (when the coil is energized the contact will be closed)
                                     but that is really  hard to follow!
                     - JUMP COIL               -(a "goto" coil) when coil is 'energized' ladder program jumps to a rung (in the CURRENT section)                                                                   
                                                      -jump points are designated by a rung label. (Add rung labels in the section display, top left label box)
                     - CALL COIL               -(a "gosub" coil) when coil is 'energized' program jumps to a subroutine section designated by a subroutine number
                                                      -subroutines are designated SR0 to SR9 (designate them in the section manager)

7. The Variables

These Variables are used in COMPARE to get information about, or change specs of, ladder objects
Such as changing a counter preset, or seeing if the a timer is done running.
List of variables :

Bxxx : Bit memory xxx (boolean)
Wxxx : Word memory xxx (32 bits integer)
Txx.R : Timer xx running (boolean, user read only)
Txx.D : Timer xx done (boolean, user read only)
Txx.V : Timer xx current value (integer, user read only)
Txx.P : Timer xx preset (integer)
Mxx.R : Monostable xx running (boolean)
Mxx.V : Monostable xx current value (integer, user read only)
Mxx.P : Monostable xx preset (integer)
Cxx.D : Counter xx done (boolean, user read only)
Cxx.E : Counter xx empty overflow (boolean, user read only)
Cxx.F : Counter xx full overflow (boolean, user read only)
Cxx.V : Counter xx current value (integer)
Cxx.P : Counter xx preset (integer)
Ixxx : Physical input xxx (boolean) - HAL input bit -
Qxxx : Physical output xxx (boolean) - HAL output bit -
Xxxx : Activity of step xxx (sequential language)
Xxxx.V : Time of activity in seconds of step xxx (sequential language)

8. Using JUMP COILs


JUMP COILs are used to 'JUMP' to another rung in the current section-like a goto in BASIC programming language.
If you look at the top left of the sections display window you will see a small lable box and a longer comment box beside it. Now go to Editor->Modify then go back to the little box,type in a name.
Go ahead and add a comment in the comment section. This label name is the name of this rung only and is used by the JUMP COIL to identify where to go.
When placing a JUMP COIL add it in the right most position and change the lable to the rung you want to JUMP to.
JUMP COILs should be placed as the last coil of a rung because of a bug. If there are coils after the JUMP COIL (in the same rung) they will be updated even if the JUMP COIL is true.
(If the JUMP COIL is true it should JUMP to the new rung right away and not update the rest of the coils of the current rung.)

9. Using CALL COILs


CALL COILs are used to go to a subroutine section then return-like a gosub in BASIC programming language.
If you go to the sections manager window hit the add section button. You can name this section, select what language it will use (ladder or sequential), and select what type (main or subroutine).
Select a subroutine number (SR0 for example). An empty section will be displayed and you can build your subroutine.
When your done that, go back to the section manager and click on the your 'main' section (default name prog1).
Now you can add a CALL COIL to your program. CALL COILs are to be placed at the right most position in the rung.
Remember to change the label to the subroutine number you choose before.
There can only be one CALL COIL per rung-the rest will not be called.

10. GRAFCET ( Sequential ) programming


This is the SEQUENTIAL editor window
Starting from the top left image:
Selector arrow , Eraser
Ordinary step , Initial (Starting) step
Transition , Step and Transition
Transition Link-Downside , Transition Link-Upside
Pass-through Link-Downside , Pass-through Link-Upside
Jump Link
Comment Box
upload:sequential_edit.png

To use links u must have steps already placed , select the type of link , then select the two steps or transactions one at a time- It takes practice!

With sequential programming:
The variable %Xxxx (eg. %X5) is used to see if a step is active.
The variable %Xxxx.V (eg. %X5.V) is used to see how long the step has been active.
The %X and %X.v variables are use in LADDER logic.
The variables assigned to the transitions (eg. %B) control whether the logic will pass to the next step.
After a step has become active the transition variable that caused it to become active has no control of it anymore.
The last step has to JUMP LINK back (only to the beginning step?)

Sequential programs do not work alone-there is always a ladder program as well that controls the variables (eg %B1).

This is a sequential program
when the program is first started step one is active
then when %B0 is true then steps 2 and 3 are then active and step one is inactive
then when %B1 and/or %B2 are true, step 4 and/or 5 are active and step 2 and/or 3 are inactive
Then when either %B3 OR %B4 are true, step 6 is true and steps 4 and 5 are inactive
then when %B5 is true step 1 is active and step 6 is inactive and it all starts again
As shown the sequence has been: %B0 was true making step 2 and 3 active
then %B1 became true (and still is-see the pink line through %B1) making step 4 active and step 2 inactive
step 3 is active and waiting for %B2 to be true
step 4 is active and is waiting for %B3 to be true
WOW that was quite a mouth full!!
upload:sequential_ladder_display2.png

11. EMC 2.2 features


Dated Aug 28 2007

-load usr program component only once-with GUI or not
-compare/equate works properly, accepts symbols
-Two variable windows, toggle button to show/hide
-HAL s32 (signed integers) IN and OUT pins
-rungs refresh at realtime period
-symbols checkbox in section display also controls variable window
-number of HAL s32 IN / OUT pins configurable when loading classicladder RT module
-should not break existing configs

Dated Sept 2 2007

-displays HAL signal names if present for %I,%Q,%W pins (but not in symbols window yet)
-you should be able to load the user program as many times as you like and the symbol window will display properly-not true yet CM.
-temparary files are now deleted-most of the time-unless HAL closes before GUI is closed


you must specify how many s32 in/out pins you want when loading the realtime module (default is 0 of each)

example:

 loadrt classicladder_rt numS32in=5 numS32out=5
This loads the realtime module with the default number of each ladder object except for it also specifies 5 s32 in pins and 5 s32 out pins
loadrt classicladder_rt numRungs=12 numBits=100 numWords=10 numTimers=10 numMonostables=10
numCounters=10 numPhysInputs=10   numPhysOutputs=10 numArithmExpr=100 numSections=4 numSymbols=200 
numS32in=5 numS32out=5
This loads the realtime module with the specified number of each ladder object.(Thats all of them).

When loading the classicladder user program please change your config to only load it once.
Previously you would load the classicladder program with the --nogui myladderprogram.clp option then load it again without using the --nogui option.
This will actually still work but it makes the symbols display window not display the symbols and can screw up saving the ladder programs.

example script-assuming ladtest is an existing ladder program

loadrt threads name1=fast fp1=0 period1=20000 name2=med period2=50000 name3=slow period3=1000000
loadrt classicladder_rt numPhysInputs=25 numPhysOutputs=25 numS32in=8 numS32out=5
addf classicladder.0.refresh slow
start
loadusr halmeter
loadusr -w classicladder  ladtest.clp

This would load the classicladder program-ladtest, halmeter, and the classicladder GUI.
The -w when loading classicladder tells hal to wait for classicladder to end before closing down the hal environment.

12. EMC 2.3 features



ClassicLadder Ver 7.124

some of the new features are:
--MODBUS should be functional-though it will be not be realtime at least to begin with.
--a STATUS bar that displays info about the ladder element you click on to.
--new timer elements timer_iec
--jump coils and call coils work better

From classicladder 7.124 history:
- Variables indexed support added in expressions.

     Example: %W0[%W4] => if %W4 equals 23 it corresponds to %W23 !
See the new example used for tests "[VarIndexed used in function]?.clp".
- Modified color of the grid during edit.
- Default font changed for a smallest: "Courier New 8". Perhaps another one could be better...
 - During edit, see the current selected element with a red rectangle around it.
- When erasing, was putting an inexistant "erase" element instead of correct free one...
     (some existent rungs projects can have that!) Drawing theses abnormal elements "(xx)"
to see them! (Now understand the case with long connections not working!!! because not "free")

13. FAQ and Feature Requests


Add a question here and Chris Morley will try to answer it. Maybe there is a feature you would like? add it here and I will look into it. ( or email the EMC-user list c/o Chris Morley)

classicladder.0.in-00 This pin connects BIT HAL pins for signal going IN to classicladder. They correspond to %I variables with the same number eg. %I0
classicladder.0.out-01 This pin connects BIT HAL pins for signals going OUT from classicladder. They correspond to %Q variables with the same number eg %Q0

If you want to use S32 pins (they represent a +- quantity) then you have to do a little more work. You have to tell the realtime module to create the s32 pins. You do this by adding commands when loading the module

loadrt classicladder_rt numS32in=5 numS32out=5 This adds 5 S32in and 5 S32out pins to classicladder

When doing this you need to make sure that the number of S32 in and out pins plus the number of word variables is not more then the number of words loaded by the realtime module
(100 words is the default, so in this example we will have 90 words variables + 5 S32in + 5 S32out =100)
The pin names for S32 look like this:

classicladder.0.S32in-00 This pin connects S32 HAL pins for signals going IN to Classicladder. They correspond to %W -the numbers depend
classicladder.0.S32out-00 This pin connects S32 HAL pins for signals coming OUT of classicladder. They correspond to %W -the numbers depend

Using the example above (5 S32 in and out requested from realtime) The numbering system for %W variable works like this:
Pin name classicladder.0.S32in-00 to 04 coresponds to %W0 to %W4
Pin name classicladder.0.S32out-00 to 04 coresponds to %W5 to %W9
words (internal memory varaibles) are %W10 to %W99
If there are no S32in pin requested then the numbering for S32out Variables start at %W0

14. BUGS


First of all there are no bugs-just undocumented features!

15. Cradeks Classicladder Cheatsheet


[Emc-users] My classicladder cheat sheet

Chris Radek
Tue, 28 Aug 2007 12:04:00 -0700

On Tue, Aug 28, 2007 at 09:47:02AM -0700, Kirk Wallace wrote:
> Thank you Ray and Jeff for your replies. I am really going to have to
> allocate some time to CL. 

It took me a while to get started with CL, but once I figured out the
basics it was easy going.  I found lots of documentation online, but
none of it seemed to be a basic introduction useful for someone like
me (a programmer type who can understand the concepts perfectly well,
but had no experience with ladder diagrams).

If I were to make a cheat sheet, here's what I would put on it.  If
you're like me I think it's exactly the summary you need:

Things specific to classicladder:

%I are input to ladder (classicladder.0.in-XX HAL pins)
%Q are outputs of ladder (classicladder.0.out-XX HAL pins)
%B are internal/intermediate signals

Things people who know ladder already know, but I didn't:

-| |- are NO
-|/|- are NC

-|^|- is rising edge
-|v|- is falling edge

-( )- is a "coil" (the rung's output)

A useful configuration used to latch a state:

    %I1     %I2    %B1
-+--| |--+--|/|----( )----
 |       |
 |  %B1  |
 +--| |--+

See how when I1 comes on, B1 turns on which latches the rung on (since
B1 is across I1, it doesn't matter what I1 does now).  Then when I2
comes on (remember it is NC because of the /), it breaks the latch and
the rung goes back off.

Once you understand this basic shape it's easy to build up sequential
logic/state machines.

Chris

16. Ladder samples


Please go to here for examples: ClassicLadderExamples


LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited April 4, 2010 12:29 pm by Chester (diff)
Search:
Published under a Creative Commons License