Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 13 of 68

Programmable Controllers C200HX-CPU-ZE, C200HG-CPU-ZE, C200HE-CPU-ZE Operation Manual: SECTION 4 Writing and Inputting the Program, pages 101 to 109

Pages 101 to 109 of 613, from Programmable Controllers C200HX-CPU-ZE, C200HG-CPU-ZE, C200HE-CPU-ZE Operation Manual

The original document is the PDF (3.8 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

Filed in the catalog under the Omron C200H-SP001 and Omron C200HW-PA204

Page 101

Section

Basic Ladder Diagrams

4-4

Now you have all of the instructions required to write simple input-output programs. Before we finish with ladder diagram basic and go onto inputting the program into the PC, let’s look at logic block instruction (AND LOAD and OR LOAD), which are sometimes necessary even with simple diagrams.

4-4-6 Logic Block Instructions Logic block instructions do not correspond to specific conditions on the ladder diagram; rather, they describe relationships between logic blocks. The AND LOAD instruction logically ANDs the execution conditions produced by two logic blocks. The OR LOAD instruction logically ORs the execution conditions produced by two logic blocks. AND LOAD

Although simple in appearance, the diagram below requires an AND LOAD instruction.

00000

00002 Instruction

00001

00003

Address

Instruction

00000 00001 00002 00003 00004 00005

LD OR LD OR NOT AND LD Instruction

Operands 00000 00001 00002 00003 ---

The two logic blocks are indicated by dotted lines. Studying this example shows that an ON execution condition will be produced when: either of the conditions in the left logic block is ON (i.e., when either IR 00000 or IR 00001 is ON), and when either of the conditions in the right logic block is ON (i.e., when either IR 00002 is ON or IR 00003 is OFF). The above ladder diagram cannot, however, be converted to mnemonic code using AND and OR instructions alone. If an AND between IR 00002 and the results of an OR between IR 00000 and IR 00001 is attempted, the OR NOT between IR 00002 and IR 00003 is lost and the OR NOT ends up being an OR NOT between just IR 00003 and the result of an AND between IR 00002 and the first OR. What we need is a way to do the OR (NOT)’s independently and then combine the results. To do this, we can use the LOAD or LOAD NOT instruction in the middle of an instruction line. When LOAD or LOAD NOT is executed in this way, the current execution condition is saved in a special buffer and the logic process is restarted. To combine the results of the current execution condition with that of a previous “unused” execution condition, an AND LOAD or an OR LOAD instruction is used. Here “LOAD” refers to loading the last unused execution condition. An unused execution condition is produced by using the LOAD or LOAD NOT instruction for any but the first condition on an instruction line.

88

Page 102

Section

Basic Ladder Diagrams

4-4

Analyzing the above ladder diagram in terms of mnemonic instructions, the condition for IR 00000 is a LOAD instruction and the condition below it is an OR instruction between the status of IR 00000 and that of IR 00001. The condition at IR 00002 is another LOAD instruction and the condition below is an OR NOT instruction, i.e., an OR between the status of IR 00002 and the inverse of the status of IR 00003. To arrive at the execution condition for the instruction at the right, the logical AND of the execution conditions resulting from these two blocks will have to be taken. AND LOAD does this. The mnemonic code for the ladder diagram is shown below. The AND LOAD instruction requires no operands of its own, because it operates on previously determined execution conditions. Here too, dashes are used to indicate that no operands needs designated or input. OR LOAD

The following diagram requires an OR LOAD instruction between the top logic block and the bottom logic block. An ON execution condition will be produced for the instruction at the right either when IR 00000 is ON and IR 00001 is OFF, or when IR 00002 and IR 00003 are both ON. The operation of the OR LOAD instruction and its mnemonic code are exactly the same as that for an AND LOAD instruction, except that the current execution condition is ORed with the last unused execution condition.

00000

00001 Instruction

00002

00003

Address

Instruction

00000 00001 00002 00003 00004 00005

LD AND NOT LD AND OR LD Instruction

Operands 00000 00001 00002 00003 ---

Naturally, some diagrams will require both AND LOAD and OR LOAD instructions. Logic Block Instructions in Series

To code diagrams with logic block instructions in series, the diagram must be divided into logic blocks. Each block is coded using a LOAD instruction to code the first condition, and then AND LOAD or OR LOAD is used to logically combine the blocks. With both AND LOAD and OR LOAD there are two ways to achieve this. One is to code the logic block instruction after the first two blocks and then after each additional block. The other is to code all of the blocks to be combined, starting each block with LOAD or LOAD NOT, and then to code the logic block instructions which combine them. In this case, the instructions for the last pair of blocks should be combined first, and then each preceding block should be combined, working progressively back to the first block. Although either of these methods will produce exactly the same result, the second method, that of coding all logic block instructions together, can be used only if eight or fewer blocks are being combined, i.e., if seven or fewer logic block instructions are required.

89

Page 103

Section

Basic Ladder Diagrams

4-4

The following diagram requires AND LOAD to be converted to mnemonic code because three pairs of parallel conditions lie in series. The two options for coding the programs are also shown. 00000

00002

00004 00500

00001

00003

Address

Instruction

00000 00001 00002 00003 00004 00005 00006 00007 00008

LD OR NOT LD NOT OR AND LD LD OR AND LD OUT

00005

Operands 00000 00001 00002 00003, 00004 00005, 00500

Address

Instruction

00000 00001 00002 00003 00004 00005 00006 00007 00008

LD OR NOT LD NOT OR LD OR AND LD AND LD OUT

Operands 00000 00001 00002 00003 00004 00005, - 00500

Again, with the method on the right, a maximum of eight blocks can be combined. There is no limit to the number of blocks that can be combined with the first method. The following diagram requires OR LOAD instructions to be converted to mnemonic code because three pairs of series conditions lie in parallel to each other. 00000 00001 00501

00002 00003

00040 00005

The first of each pair of conditions is converted to LOAD with the assigned bit operand and then ANDed with the other condition. The first two blocks can be coded first, followed by OR LOAD, the last block, and another OR LOAD; or the three blocks can be coded first followed by two OR LOADs. The mnemonic codes for both methods are shown below. Address

Instruction

00000 00001 00002 00003 00004 00005 00006 00007 00008

LD AND NOT LD NOT AND NOT OR LD LD AND OR LD OUT

Operands 00000 00001 00002 00003, 00004 00005, 00501

Address

Instruction

00000 00001 00002 00003 00004 00005 00006 00007 00008

LD AND NOT LD NOT AND NOT LD AND OR LD OR LD OUT

Operands 00000 00001 00002 00003 00004 00005, - 00501

Again, with the method on the right, a maximum of eight blocks can be combined. There is no limit to the number of blocks that can be combined with the first method. Combining AND LOAD and OR LOAD

90

Both of the coding methods described above can also be used when using AND LOAD and OR LOAD, as long as the number of blocks being combined does not exceed eight.

Page 104

Section

Basic Ladder Diagrams

4-4

The following diagram contains only two logic blocks as shown. It is not necessary to further separate block b components, because it can be coded directly using only AND and OR. 00000 00001

00002 00003 00501

00201

00004

Block a

Block b

Address

Instruction

00000 00001 00002 00003 00004 00005 00006 00007

LD AND NOT LD AND OR OR AND LD OUT

Operands 00000 00001 00002 00003 00201 00004, 00501

Although the following diagram is similar to the one above, block b in the diagram below cannot be coded without separating it into two blocks combined with OR LOAD. In this example, the three blocks have been coded first and then OR LOAD has been used to combine the last two blocks, followed by AND LOAD to combine the execution condition produced by the OR LOAD with the execution condition of block a. When coding the logic block instructions together at the end of the logic blocks they are combining, they must, as shown below, be coded in reverse order, i.e., the logic block instruction for the last two blocks is coded first, followed by the one to combine the execution condition resulting from the first logic block instruction and the execution condition of the logic block third from the end, and on back to the first logic block that is being combined. Block b1 00000 00001

00002 00003 00502

00004 00202

Block b2

Block a

Block b

Complicated Diagrams

Address

Instruction

00000 00001 00002 00003 00004 00005 00006 00007 00008

LD NOT AND LD AND NOT LD NOT AND OR LD AND LD OUT

Operands 00000 00001 00002 00003 00004 00202, - 00502

When determining what logic block instructions will be required to code a diagram, it is sometimes necessary to break the diagram into large blocks and then continue breaking the large blocks down until logic blocks that can be coded without logic block instructions have been formed. These blocks are then coded, combining the small blocks first, and then combining the larger blocks. Either AND LOAD or OR LOAD is used to combine the blocks, i.e., AND LOAD or OR LOAD always combines the last two execution conditions that existed, regardless of whether the execution conditions resulted from a single condition, from logic blocks, or from previous logic block instructions.

91

Page 105

Section

Basic Ladder Diagrams

4-4

When working with complicated diagrams, blocks will ultimately be coded starting at the top left and moving down before moving across. This will generally mean that, when there might be a choice, OR LOAD will be coded before AND LOAD. The following diagram must be broken down into two blocks and each of these then broken into two blocks before it can be coded. As shown below, blocks a and b require an AND LOAD. Before AND LOAD can be used, however, OR LOAD must be used to combine the top and bottom blocks on both sides, i.e., to combine a1 and a2; b1 and b2. Block a1 00000 00001

Block b1 00004 00005 00503

00002 00003

00006 00007

Block a2

Block b2

Block a

Block b

Blocks a1 and a2

Blocks b1 and b2 Blocks a and b

Address

Instruction

00000 00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011

LD AND NOT LD NOT AND OR LD LD AND LD AND OR LD AND LD OUT

Operands 00000 00001 00002 00003, 00004 00005 00006 00007, - 00503

The following type of diagram can be coded easily if each block is coded in order: first top to bottom and then left to right. In the following diagram, blocks a and b would be combined using AND LOAD as shown above, and then block c would be coded and a second AND LOAD would be used to combined it with the execution condition from the first AND LOAD. Then block d would be coded, a third AND LOAD would be used to combine the execution condition from block d with the execution condition from the second AND LOAD, and so on through to block n. 00500

Block a

92

Block b

Block c

Block n

Page 106

Section

Basic Ladder Diagrams

4-4

The following diagram requires an OR LOAD followed by an AND LOAD to code the top of the three blocks, and then two more OR LOADs to complete the mnemonic code. 00000

00001

Address

Instruction

00000 00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012

LD LD LD AND NOT OR LD AND LD LD NOT AND OR LD LD NOT AND OR LD OUT

Operands

LR 0000 00002

00004

00005

00006

00007

00003

00000 00001 00002 00003 –– –– 00004 00005 –– 00006 00007 –– LR 0000

Although the program will execute as written, this diagram could be drawn as shown below to eliminate the need for the first OR LOAD and the AND LOAD, simplifying the program and saving memory space. 00002

00003

00000 LR 0000

00001

00004

00005

00006

00007

Address

Instruction

00000 00001 00002 00003 00004 00005 00006 00007 00008 00009 00010

LD AND NOT OR AND LD NOT AND OR LD LD NOT AND OR LD OUT

Operands 00002 00003 00001 00000 00004 00005 –– 00006 00007 –– LR 0000

The following diagram requires five blocks, which here are coded in order before using OR LOAD and AND LOAD to combine them starting from the last two blocks and working backward. The OR LOAD at program address 00008 combines blocks blocks d and e, the following AND LOAD combines the resulting execution condition with that of block c, etc. 00000

00001

00002 LR 0000

Block b Block a Block c 00003

00004

Block d 00005

00006

00007 Blocks d and e Block c with result of above

Block e

Block b with result of above Block a with result of above

Address

Instruction

00000 00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012

LD LD AND LD AND LD LD AND OR LD AND LD OR LD AND LD OUT

Operands 00000 00001 00002 00003 00004 00005 00006 00007 –– –– –– –– LR 0000

93

Page 107

Section

Basic Ladder Diagrams

4-4

Again, this diagram can be redrawn as follows to simplify program structure and coding and to save memory space.

00006

00007

00003

00004

00000

Address

Instruction

00000 00001 00002 00003 00004 00005 00006 00007 00008 00009

LD AND OR AND AND LD AND OR LD AND OUT

LR 0000 00005

00001

00002

Operands 00006 00007 00005 00003 00004 00001 00002 –– 00000 LR 0000

The next and final example may at first appear very complicated but can be coded using only two logic block instructions. The diagram appears as follows: Block a 00000

00001

01000

01001

00002

00003

00004

00005 00500

00006

00500 Block b

Block c

The first logic block instruction is used to combine the execution conditions resulting from blocks a and b, and the second one is to combine the execution condition of block c with the execution condition resulting from the normally closed condition assigned IR 00003. The rest of the diagram can be coded with OR, AND, and AND NOT instructions. The logical flow for this and the resulting code are shown below. Block a

Block b

00000

00001

01000

01001

LD AND

00000 00001

LD AND

01000 01001

OR LD Block c 00500

00005

00004 00005

OR

00500

LD AND

00002

00003

00006

AND 00002 AND NOT 00003

LD

AND LD

00500

94

00004

00006

Address

Instruction

00000 00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012

LD AND LD AND OR LD OR AND AND NOT LD AND OR AND LD OUT

Operands 00000 00001 01000 01001 –– 00500 00002 00003 00004 00005 00006 –– 00500

Page 108

Section

The Programming Console

4-5

4-4-7 Coding Multiple Right-hand Instructions If there is more than one right-hand instruction executed with the same execution condition, they are coded consecutively following the last condition on the instruction line. In the following example, the last instruction line contains one more condition that corresponds to an AND with IR 00004. 00000

00003

HR 0001

00001 00500 00002

00004 00506

HR 0000

4-5

Address

Instruction

00000 00001 00002 00003 00004 00005 00006 00007 00008

LD OR OR OR AND OUT OUT AND OUT

Operands 00000 00001 00002 HR 0000 00003 HR 0001 00500 00004 00506

The Programming Console This and the next section describe the Programming Console and the operations necessary to prepare for program input. 4-7 Inputting, Modifying, and Checking the Program describes actual procedures for inputting the program into memory. Although the Programming Console can be used to write ladder programs, it is primarily used to support SYSMAC-CPT Support Software operations and is very useful for on-site editing and maintenance. The main Programming Console functions are listed below. 1, 2, 3...

1. Displaying operating messages and the results of diagnostic checks. 2. Writing and reading ladder programs, inserting and deleting instructions, searching for data or instructions, and monitoring I/O bit status. 3. Monitoring I/O status, force-setting/resetting bits. 4. The Programming Console can be connected to or disconnected from the PC with the power ON. 5. The Programming Console can be used with C-series PCs. 6. Supports TERMINAL mode, which allows the display of a 32-character message, as well as operation of the keyboard mapping function. Refer to 5-26-6 TERMINAL MODE – TERM(048) for details.

Note The Programming Console does not support all of the SYSMAC-CPT Support Software operations, only those required for on-site editing and maintenance.

4-5-1 The Keyboard The keyboard of the Programming Console is functionally divided by key color into the following four areas: White: Numeric Keys

The ten white keys are used to input numeric program data such as program addresses, data area addresses, and operand values. The numeric keys are also used in combination with the function key (FUN) to enter instructions with function codes. The numeral keys 0 to 5 are also pressed after the SHIFT key to input hexadecimal numerals A to F.

Red: CLR Key

The CLR key clears the display and cancels current Programming Console operations. It is also used when you key in the password at the beginning of programming operations. Any Programming Console operation can be cancelled

95

Page 109

The Programming Console

Section

4-5 by pressing the CLR key, although the CLR key may have to be pressed two or three times to cancel the operation and clear the display. Yellow: Operation Keys

The yellow keys are used for writing and correcting programs. Detailed explanations of their functions are given later in this section.

Gray: Instruction and Data Area Keys

Except for the SHIFT key on the upper right, the gray keys are used to input instructions and designate data area prefixes when inputting or changing a program. The SHIFT key is similar to the shift key of a typewriter, and is used to alter the function of the next key pressed. (It is not necessary to hold the SHIFT key down; just press it once and then press the key to be used with it.)

96