Topic: DMD0220

The Ladder Editor


Edit Mode vs. Display Mode

Ladder Views have two viewing modes; the Display Mode and the Edit Mode. When a project is first opened, the Ladder View will be in the Display Mode, which is only a viewing mode. A code-block cannot be edited in this mode. In order to edit the contents of a code-block, the Ladder View must be in the Edit Mode. To enable the Edit Mode, either click on the Edit Mode button on the Offline toolbar, or select the Edit-> Edit Mode menu option, or use the keyboard shortcut Ctrl+E.

 

Note: there is visible confirmation that the Edit Mode is enabled: the edit cursor changes from a hollow box to a solid box, the background changes for the Edit Mode button on the Offline toolbar, and the elements in the Ladder Palette are enabled.

 

Note: Edit Mode and Display Mode are not selected for individual code-blocks, meaning that if there are multiple code-blocks open at the same time, enabling Edit Mode enables Edit Mode for all of the currently open code blocks, and any code blocks that are opened while Edit Mode is enabled.

 

Edit Mode only applies to Ladder views; the System Configuration and Element Documentation can be changed without Edit Mode being enabled. The Project Browser DOES require that a code-block be in edit mode before the configuration of that code-block can be changed.

 

Project Changed Bars

As edits are made to the contents of a code-block, Do-more Designer will display one or more of the three colored bars to the left of the rung's number. These colored bars indicate that the project has been changed and some additional actions are required to complete the changes.

 

A  yellow  bar indicates that the rungs have been edited, but not yet Accepted.

 

A  green  bar indicates that the changes to the rung have been Accepted but not yet saved to disk. The Save button on the Offline toolbar will also be enabled.

A  cyan  bar indicates that the changes to the rung have been Accepted but not yet saved to the controller.  The Write PLC button on the Online toolbar will also be enabled indicating that the changes can now be written to the controller. It is not necessary to save the project to disk before downloading the program to the controller, however, it has always been good practice to save your work as you make changes to a project.

 

Note: at the same time the Write PLC button was enabled, the Read PLC button was also enabled. This allows the programmer the option to restore the program to the state that it was before the changes were made. The Read PLC operation will refresh the screen with the previously saved version of your program.

 

Note: the Project Differences indicators on the Status Bar will also indicate any differences between the Disk and controller versions of the project.

 

Creating Nicknames for Program Elements

Nicknames are user-assigned alternate names for programming elements. Once a Nickname has been assigned to an element the Nickname and the Element ID can be used interchangeably within the project. Any time an instruction editor is closed with an unknown Element reference, the programmer will be presented with the Create Nickname dialog.

 

Nickname - the Nickname to be created. Nicknames can be 1 to 16 characters in length and consist of any combination of alphanumeric characters and underscores ('_', 'a-z', 'A-Z', 0-9), no spaces or punctuation marks are allowed, and must begin with a letter or an underscore.

 

Associated Element - displays the memory element that will be associated with the Nickname
 

Create nickname and ... - selects what action to perform with the nickname
 

  • ... assign to first unused element of specified type - select this option then use the Type drop-down menu to specify the data type to assign the nickname text to the first element in the range that is not currently being used in the project
     

  • ... assign to specified element - select this option to assign the nickname text to a specific memory element
     

  • ... leave unassigned - select which of the following types of controller element this Nickname will eventually refer to:
     

    • Bit (X, Y, C, etc.) - if this Nickname will be assigned to a BIT location
       

    • Numeric (D, R, V, etc.) - if this Nickname will be assigned to a numeric location
       

    • Structure (Counter, PID, etc.) - if this Nickname will be assigned to a structure element

 

 

Accept Changes

Any changes that are made to the contents of a code-block must be accepted before they can be downloaded to the controller. The Accept operation will optimize the way that rungs are drawn - only valid rungs will be optimized, invalid rungs will not be changed. As noted above, any rungs that have been changed will be flagged with a Yellow change bar. Once the rungs are accepted with no errors, the yellow bar will go away and a green bar will appear. If the programming session is online, a cyan bar will also appear.

 

Note: Accepting Changes is not selected for individual code-blocks, meaning that if there are multiple code-blocks that have been changed an Accept operation will be applied to all of the currently open code blocks.

 

A part of optimizing a rung is checking the rung for incorrectly drawn or unconnected programming elements: what follows is a list of the common drawing errors and how to resolve them.

 

ORing two complex output elements which aren't AND's or JOIN's

 

Problem: This message may be displayed for a rung that contains additional input logic on a leg of a midline output that is illegal. After the vertical wire has been dropped to AND a sub-rung with a midline output, no additional input logic may appear on each leg of the midline output.

 

Solution: Edit the rung and re-enter all of the common logic in each leg that had additional input logic. This will create additional rungs, but they will be logically equivalent to the original rung.

 


Trying to AND above a JOIN

 

Problem: This message may be displayed for a rung that contains additional input logic on the leg of a mid-line output that is illegal. After the vertical wire has been dropped to AND a sub-rung with a mid-line output, no additional input logic may appear on the leg of the mid-line output.

 

Solution: Edit the rung and delete all contacts that appear after the vertical wire on the leg of the mid-line output.

 


Shorted Input Legs

 

Problem: This message may be displayed for a rung that contains a box instruction that has multiple inputs legs that have been shorted together. Each input leg of a box must be independently connected to the power rail.

 

Solution: connect each input leg independently to the left power rail.

 

 


Conditional Outputs Require Input logic

 

Problem: This message will be displayed for a rung that contains a box instruction that has one of it's inputs directly connected to the power rail.

 

Solution: connect each input leg to the left power rail with a ladder logic contact instruction.

 


How to Enter Contacts on a Rung

After enabling Edit Mode, entering new contacts on a rung can be done using any of the following methods:
 

  • Contact Browser (F4) - press the F4 key to invoke the Instruction Browser where the desired type of contact can be selected from a list. Once the contact is selected, the Contact Browser dialog will close and the contact instruction editor will open so that the parameters for the selected contact can be entered.
     

  • Use the Ladder Palette - place the edit cursor at the desired location on the rung then left-click the desired contact symbol on the palette. This will open the contact instruction editor where the parameters for the selected contact can be entered.
     

  • Function Key or Hot Key - place the edit cursor at the desired location on the rung then press the Function key or Hotkey associated with the desired contact. This will open the contact instruction editor where the parameters for the selected contact can be entered.
     

  • Double-click at the desired location - this will create a normally-open contact at that location on the rung and open the contact instruction editor where the parameters for the selected contact can be entered. Note: Use the forward-slash key ( / ) to toggle between a normally open and normally closed contact.
     

  • Type the name of the Memory location or its Nickname - this will create a normally-open contact at that location on the rung and open the contact instruction editor where the parameters for the selected contact can be entered. Note: Use the forward-slash key ( / ) to toggle between a normally open and normally closed contact.
     

After selecting the type of contact to enter, the Contact Instruction Editor will be displayed with either the parameter that was selected, or with the default parameter for the type of Contact selected.

 

Take note of the green dot in the upper right corner of the editor, and a similar one in the parameter field. A  green  dot in the parameter field indicates a valid parameter has been entered for this field, a green dot for the instruction indicates that all fields of the instruction have valid entries. If the green dot changes to  red , it means that the address is not valid for this contact, or the parameter is incomplete or misspelled. For example, if the letter ”O” is entered instead of the digit ”0”, the indicator would turn red and stay red until the mistake is corrected.

 

While the parameter field is being edited, the instruction will display an "auto-complete" drop-down below the parameter field. This drop-down will display any valid range of memory locations that match the characters entered in the field. As more characters are entered the ranges displayed will change to continue displaying matches.

 

If there are no characters in the parameter field, pressing the down arrow will display the drop-down list of all the Ranges of Memory Elements and individual memory elements that are valid for this contact type. Use the down arrow or the thumb bar to scroll through the list.

 

As the cursor moves through the list the Item or Range under the cursor is entered in the parameter field. If the value is one of the Ranges of Memory Elements, the parameter will need to be edited further so that just the one parameter from that range remains in the field.

There is one notable exception to this functionality, that is when the cursor is over a structure field.

The initial auto-complete drop-down list will only display the name of the structure, not the individual fields that the structure contains. When the structure name is selected and the programmer enters a "." after the name, the drop-down list will display all of the fields of that structure which are valid for use in a Contact. This new list can then be navigated and the desired structure field can be selected by pressing the Enter key.

Relational Contacts have two parameters that must be entered. The process of entering the parameters for the fields is the same as is used for normal contacts. Pressing the Tab key will move the edit cursor from one parameter field to the other. Because the relational contacts contain arithmetic operations, the down-arrow auto complete list will additionally contain valid ranges of constant values.

 

After supplying the required parameters, pressing the Enter key or clicking on the button with the check mark in upper left corner of the Contact Instruction editor will enter the contact on the rung and the edit cursor will move to the next entry position. A vertical yellow change bar will appear to the left of the left of the rung. As noted earlier, the yellow bar indicates that some type change has been made to the rung but the change has not been Accepted.

 


How To Enter Output Coils on a Rung

Entering output coils on a rung is a very similar process to entering contacts, the main difference is that all of the output coils are placed in a single column at the far right edge of the Ladder View, this is called the output column.

 

After enabling Edit Mode, entering new coils on a rung can be done using any of the following methods:
 

  • Coil Browser (F5) - press the F5 key to invoke the Instruction Browser where the desired type of coil can be selected from a list. Once the coil type is selected, the Instruction Browser dialog will close and the coil instruction editor will open so that the parameters for the selected coil type can be entered.
     

  • Double-click in the output column on the desired rung - this will create an output coil on the rung and open the coil instruction editor where the parameters for the coil can be entered.
     

  • Place the edit cursor in the output column and type the name of the Memory location or its Nickname - this will create an output coil on the rung and open the coil instruction editor where the parameters for the coil can be entered.
     

  • Use the Ladder Palette - place the edit cursor in the output column on the rung then left-click the desired coil symbol on the palette. This will open the coil instruction editor where the parameters for the selected coil can be entered.

 

After selecting the type of coil to enter, the Coil Instruction editor will be displayed with either the parameter that was entered, or with the next unused default parameter for the type of Coil selected.

 

The Coil Instruction editor provides the same auto-complete functionality that is described above with Contacts.

 

After supplying the required parameters, pressing the Enter key or clicking on the button with the check mark in upper left corner of the Coil Instruction editor will enter the coil on the rung. A vertical yellow change bar will appear to the left of the rung. As noted earlier, the yellow bar indicates that a change has been made to the rung but the change has not been Accepted.

 


How to Enter Box Instructions on a Rung

Like output Coils, all Box instructions are placed in a single column at the far right edge of the Ladder View, this is called the output column.

 

After enabling Edit Mode, entering new boxes on a rung can be done using any of the following methods:
 

  • Box Browser (F7) - press the F7 key to invoke the Instruction Browser where the desired box instruction can be selected from a list. Once the box is selected, the Instruction Browser dialog will close and the box instruction editor will open so that the parameters for the selected box can be entered.
     

  • Place the edit cursor in the output column and type the name of the Box Instruction - this will create that instruction on the rung and open the box instruction editor where the parameters for the box can be entered.

 

Because the Box instructions vary greatly in number of parameters and complexity, each Box instruction has it's own editor. Each of the Box Instruction editors provides the auto-complete functionality where appropriate, and it will operate similarly to what is described above with Contacts and Coils.

 

After supplying the required parameters, pressing the Enter key or clicking on the button with the check mark in upper left corner of the Box Instruction editor will enter the box on the rung. A vertical yellow change bar will appear to the left of the rung. As noted earlier, the yellow bar indicates that a change has been made to the rung but the change has not been Accepted.

 

Entering power rail instructions needs special consideration. Power rail instructions are box instructions that are displayed in the power rail of the Ladder View, not in the output column like the other box instructions. Even though these instructions are displayed in the left-most column of the ladder diagram (the power rail), they are still created in the right-most column of the ladder logic diagram (the output column).

 

This makes creating the instructions in Do-more Designer a bit counter-intuitive in that the first step is to position the edit cursor in the output column of the ladder logic diagram (the far right) instead of positioning it against the power rail (the far left).

 

 

After selecting the type of power rail instruction the Box Instruction editor will then be displayed in the far left column (the power rail).

 

 

After entering the required parameters for the power rail instruction the box will be drawn as follows:

 

 

The following is a list of the power rail instructions:

SG - Stage, SGCONVRG - Converge Multiple Stages to SG

 

FOR - Index Loop / NEXT - Index By Step
 

REPEAT - Loop Until Condition is Non-Zero / UNTIL - Repeat Until Condition is Non-Zero
 

WHILE - Loop While Powerflow is True / WEND - While End

 

LABEL - Program Label

 


The Ladder Instruction Palette

The Ladder Instruction Palette is a modeless dialog that provides a graphical list of all the instructions available for use in the current Do-more Designer project. Hovering the cursor over any of the instruction mnemonics will display a tooltip with a short version of the instruction help, clicking on the Tooltip will display the full version of that instruction's Help documentation.

 

 

Show this palette automatically when in 'Edit Mode' - the default selection will cause the instruction palette to be displayed any time a Ladder View has Edit Mode enabled and a Ladder View has focus. Uncheck this feature to prevent the Ladder Palette from being displayed.

 

Click the Options button to invoke the Options dialog where changes can be made to the Instruction Palette display. The available options are discussed below.

 

Click the Close button to close the Instruction Palette dialog. The ladder palette will be displayed again the next time Edit Mode is enabled.

 

The Options dialog of the Ladder Instruction Palette provides control over the following:

 

  • Types (classes) of instructions that are displayed on the palette
     

  • The on-screen shape of the instruction palette by selecting either Square (the default or Tall
     

  • Whether or not to display tooltips when the cursor hovers over an instruction on the palette

 

 


How To Delete Contacts, Coils, or Box Instructions

Deleting contacts, coils or box instructions from a rung of ladder logic is accomplished by enabling Edit Mode, then placing the Edit cursor over the contact, coil or box instruction to be deleted and pressing the Delete key, or the Edit-> Delete menu selection.

 

The Backspace key can also be used to delete the contact to the immediate left of the edit cursor. Unlike the Delete operation which will leave a gap in the connecting wire, this operation will redraw the connecting wire in place of  the deleted contact.

 

Depending on what element was deleted, and where it was located on the ladder logic rung, the delete process may leave a gap in the connecting wire. A gap in the connecting wires can be corrected by drawing new connecting wire (as described below), or possibly just Accepting the changes (which will optimize the rung and redraw it if needed).

 


How To Draw Wires Between Contacts and Coils

Creating complex ladder logic requires the ability to "draw" networks of input contacts and the ability to connect multiple output coils or box instructions in parallel. Do-more Designer uses the Ctrl key with the arrow keys to draw connecting wires in the direction of the arrow.

 

Wire Right (Ctrl + Right Arrow) - draws a horizontal wire in the current cursor location and moves the cursor to the right. Note: drawing a connecting wire over the top of a contact will not delete that contact; it will simply connect it if needed.

 

Wire Left (Ctrl + Left Arrow) - draws a horizontal wire in the current cursor location and moves the cursor to the left. Note: drawing a connecting wire over the top of a contact will not delete that contact; it will simply connect it if needed.

 

Wire Down (Ctrl + Down Arrow) - draws a vertical wire along the left edge of the edit cursor down from the current cursor location and moves the cursor down to the next row.

 

Wire Up (Ctrl + Up Arrow) - draws a vertical wire along the left edge of the edit cursor up from the current cursor location and moves the cursor up to the previous row.

 

Wire to Output Column (Ctrl +W) - draws a connecting wire from the current cursor location all the way to the output column. Pressing it again will remove the connecting wire that was just drawn.

 


During the process of editing ladder logic rungs, there will be times when a connecting wire needs to be deleted. Do-more Designer uses the Ctrl key and the Shift key with the arrow keys to delete connecting wires in the direction of the arrow.

 

Wire Delete Right (Ctrl + Shift + Right Arrow) - deletes the horizontal wire or programming element in the current cursor location and moves the cursor to the right.

 

Wire Delete Left (Ctrl + Shift + Left Arrow) - deletes the horizontal wire or programming element in the current cursor location and moves the cursor to the left.

 

Wire Delete Down (Ctrl + Shift + Down Arrow) - deletes the vertical wire along the lower left edge of the edit cursor and moves the cursor down to the next row.

 

Wire Delete UP (Ctrl + Shift + Up Arrow) - deletes the vertical wire along the upper left edge of the edit cursor and moves the cursor up to the previous row.

 


How To Insert Rungs, Rows, or Columns

There will be times when building ladder logic programs that space for additional rungs or more space on existing rungs is needed. The Insert dialog allows the programmer to insert additional rungs to a ladder logic program, or add additional rows or columns to existing rungs. These operations are handled through the Insert dialog.

 

What? - designates whether Rungs, Rows or Columns are to be inserted
 

  • Rung - insert one or more empty rungs before or after the current rung. The Rung Comment location will be preserved.
     

  • Row - insert one or more empty rows into the current rung. Rows can be inserted before or after the current row. Insert rows to create parallel branches of ladder logic, or additional outputs. Vertical wires are stretched through newly inserted row to preserve parallel connections. Box instructions with multiple inputs are extended when rows are inserted to preserve input connections.
     

  • Column - insert one or more empty columns into the current rung. Columns can be inserted before or after the current column. Use insert column to create space for a new contact before an existing contact. Horizontal wires are extended through newly inserted columns to preserve connections.

 

Note: to quickly insert one new row before the current row, place the edit cursor at the far left edge beginning of the current row (next to the power rail), and press the Enter key. To quickly add one new row after the current row, place the edit cursor anywhere on the current row except at the far left edge, and press the Enter key, or press Ctrl+ Enter.

 

Where? - specifies where to insert the new rungs, rows, or columns relative to the edit cursor position
 

  • Before Cursor - select this option to insert new rungs or rows above the row where the edit cursor is currently positioned, or to insert new columns to the left of the edit cursor
     

  • After Cursor - select this option to insert new rungs or rows below the row where the edit cursor is currently positioned, or to insert new columns to the right of the edit cursor

 

How Many? - designates how many rungs, rows or columns to insert. The default value is one. Enter the desired number in the space provided.

 

Click the OK button to perform the Insert operation.

 

Click the Cancel button to close the Insert dialog without performing the insert operation.

 


How To Merge Multiple Rungs into a Single Rung

There may be times during editing sessions when the ladder logic on two adjacent rungs need to be combined into a single rung. One way to accomplish this is to edit one rung and manually add all of the needed ladder logic from the adjacent rung, manually copy / paste the rung comment text from the adjacent rung, and then delete the adjacent rung. A better way is to use the Merge feature to combine the ladder logic and the Rung Comments on two adjacent rungs into a single rung.

 

Position the Edit cursor on one of the rungs to merge, then select the appropriate Merge selection from the Edit menu:

 

  • Edit-> Merge-> Previous Rung - merge the previous rung and it's rung comment with the current rung and it's rung comment
     

  • Edit-> Merge-> Next Rung - merge the current rung with its rung comment with the next previous rung and it's rung comment

    Note:
    If you haven't Accepted the merged rungs, use the Edit History feature to restore the original rungs along with their individual rung comments.

 

This example shows two simple rungs before being merged:

 

This is the same two rungs after being merged:

 

Notice that both rungs of ladder logic are now at rung #1, and that a yellow Changed Bar is displayed at the left edge, and that Rung #2 is now empty. At this point the programming elements on this new rung need to be manually rearranged and the Rung Comment text needs to be manually edited.

 


How To Delete Entire Rungs

A single rung of ladder logic and any programming elements on that rung can be deleted by positioning the edit cursor anywhere on the rung to delete then pressing the Delete key twice.

 

Deleting multiple rungs is done through the Select for Delete operation as described in the next section.

 

A dialog will be displayed asking the programmer to confirm the delete rung operation.

 

Click the OK button to delete the rung.

 

Click the Cancel button to close the dialog without deleting the rung.

 

Note: after a rung delete operation has been executed, the Save to Disk, Read PLC, and Write PLC buttons will be enabled which signifies that the on-screen copy of the project does not match the copy stored on Disk and the copy stored in the controller.


How To Select Rungs for Cut, Copy, Paste and Delete

There will be times when building ladder logic programs that complete rungs of ladder logic need to be moved or duplicated within the same code-block, or a different code-block, or even a different project. Do-more Designer provides this functionality by allowing the programmer to select the rungs and use either a Cut or Copy function within the source code-block, then paste the selected rungs in the destination code-block.

 

Selecting a rung of ladder logic also selects the Rung Comment if it exists, so any Cut, Copy, Paste or Delete operation that is performed on a rung will also affect the Rung Comment.

 

The first step is to select the rungs in the source code-block. This is done by positioning the cursor on the first rung of the selection then use the appropriate keystroke sequence as described below. Each rung that is selected is highlighted with a different background color.

 

Note: only entire rungs of ladder logic can be selected, not individual programming elements on a rung.

 

Note: before a rung can be selected for a Cut or Copy operation, any changes to the rung must be Accepted.

 

Select Up ( Shft + Up Arrow  or  Shft + Left Arrow ) - selects rungs upward (backward) through the code-block. The first time the key combination is pressed the current rung is selected. Each successive use adds the previous rung to the selection.

 

Select Down ( Shft + Down Arrow or  Shft + Right Arrow ) - selects rungs downward (forward) through the code-block. The first time the key combination is pressed the current rung is selected. Each successive use adds the next rung to the selection.

 

Select Home ( Ctrl + Shft + Home ) - selects all of the rungs from the current rung to the beginning of the code-block.

 

Select End ( Ctrl + Shft + End ) - selects all of the rungs from the current rung to the end of the code-block.

 

The following example shows rungs numbers 2 and 3 have been selected:

 

After selecting the rungs, choose one of the following operations to perform on the selection:.

 

  • Cut ( Ctrl + X ) - the currently selected rungs will be copied to the Clipboard, then the selected rungs are deleted from the code-block. The Paste operation can now be used to move the selected rungs to one or more different locations

    Note:
    If you wish to copy the original selection without deleting it, use the Copy command.

 

  • Copy ( Ctrl + C ) - the currently selected rungs will be copied to the Clipboard. The Paste operation can now be used to duplicate the selected rungs in one or more different locations.

    Note: If you wish to delete the original selection after copying it, use the Cut command.

 

  • Paste ( Ctrl + V ) - will place a copy the rungs of ladder logic currently in the Clipboard at the location of the Edit cursor. To use the Cut/Copy/Paste operation between projects, open a second instance of Do-more Designer, open the second project, and enable Edit Mode.

    Note:
    If a new selection has been made, the Paste operation will overwrite the rungs that are currently selected. Otherwise, if there is nothing selected, paste inserts before the cursor.

 

When pasting the Clipboard contents into a different Do-more Designer project, the Paste Options dialog box will be displayed where the programmer can specify how to handle Element Documentation.

 

Don't paste documentation - pastes only rungs and rung comments. It does NOT paste documentation for the elements in the rungs. See notes below on nicknames.

Paste, but don't overwrite existing documentation
- pastes rungs and rung comments; and documentation for elements in the rungs which have no documentation in the target project. Existing documentation in the project is not changed. See notes below on nicknames.

Paste, overwriting old documentation
-  pastes rungs and rung comments; and documentation for each element used in the pasted rungs. If the target project already had documentation for the elements in the pasted rungs, it will be overwritten. See notes below on nicknames.

Note:
If there are unassigned nicknames in the rungs that will be pasted, that documentation will always be pasted. The Documentation Option you select above has no affect on them.

 

Note: Nicknames must be unique within a project, so, if the Clipboard contains a programming element with a Nickname that already exists in the target project, AND the two Nicknames are tied to two different programming elements, the pasted Nickname will be 'mangled' to create a unique nickname. Any Nickname that must be mangled will be listed in the Output Window.
 

Click the Paste It! button to perform the Paste operation.

Click the
Abort button to cancel the Paste operation.

 

  • Delete - Pressing the Delete key will remove the selected rungs from the code-block.

    Note:
    the Delete operation does not place the deleted contents into the Clipboard. To restore accidentally deleted rungs the programmer must use the Undo (Edit History / Ctrl + Z) feature.

 


See Also:

 


Copyright © Host Engineering, Inc. ALL RIGHTS RESERVED