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

The text of a manual · part 15 of 27

SYSMAC C20P/C28P/C40P/C60P P-type Programmable Controllers Operation Manual: SECTION 7, pages 112 to 121

Pages 112 to 121 of 211, from SYSMAC C20P/C28P/C40P/C60P P-type Programmable Controllers Operation Manual

The original document is the PDF (2.2 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.

For the Omron C28P

Page 112

SECTION 7 Program Input, Debugging and Execution 7–1 7–2

7–3

7–4

7–5

7–6

7–7 7–8

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Converting to Mnemonic Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–2–1 Program Memory Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–2–2 Ladder Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–2–3 Logic Block Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–2–4 Coding Other Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The Programming Console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–3–1 The Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–3–2 PC Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Preparation for Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–4–1 Entering the Password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–4–2 Clearing Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Inputting, Modifying, and Checking the Program . . . . . . . . . . . . . . . . . . . . . . . . . 7–5–1 Setting and Reading from Program Memory Address . . . . . . . . . . . . . 7–5–2 Inputting or Overwriting Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–5–3 Checking the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–5–4 Displaying the Scan Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–5–5 Program Searches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–5–6 Inserting and Deleting Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . Program Backup and Restore Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–6–1 Saving Program Memory Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–6–2 Restoring or Comparing Program Memory Data . . . . . . . . . . . . . . . . . Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Monitoring Operation and Modifying Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–8–1 Bit/Digit Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–8–2 Force Set/Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–8–3 Hexadecimal/BCD Data Modification . . . . . . . . . . . . . . . . . . . . . . . . . 7–8–4 Changing Timer/Counter SV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

106 106 106 106 107 116 121 121 123 124 125 126 128 128 129 132 133 134 136 140 140 141 143 144 145 148 151 151

105

Page 113

Converting to Mnemonic Code

7–1

Section 7–2

Introduction This section provides the procedures for inputting and debugging a program and monitoring and controlling the PC through a Programming Console. The Programming Console is the most commonly used Programming Device for the K-type PCs. It is compact and available both in hand-held models or CPU-mounted models. Refer to Appendix A Standard Models for model numbers and other details. If you are using a GPC, FIT, or a computer running LSS, refer to the Operation Manual for corresponding procedures on these. If you are going to use a GPC, FIT, or a computer running LSS, but want to input in mnemonic code rather than in ladder-diagram form, refer to 7–2 Converting to Mnemonic Code.

7–2

Converting to Mnemonic Code Before a program can be input via a Programming Console, it must be converted to mnemonic code. Converting a ladder diagram to mnemonic code prepares it so that it can be keyed directly into the appropriate Program Memory addresses.

7–2–1

Program Memory Structure The program is input into addresses in Program Memory. Addresses in Program Memory are slightly different than those in other memory areas because each address does not necessarily hold the same amount of data. Rather, each address holds one instruction and all of the definers and operands required for that instruction. Because some instructions require no operands, while other require up to three operands, Program Memory addresses can be from one to four words long. Program Memory addresses start at 0000 and run until the capacity of Program Memory has been exhausted. The first word at each address defines the instruction. Any definers and some bit operands used by the instruction are also contained in the first word. The rest of the words required by an instruction contain the operands that tell what data is to be used. When converting to mnemonic code, instructions are written in the same form, one word to a line, just as they appear in the ladder diagram symbols. The only exception to this is TIMH(15), in which the definer is written on a second line. When programming, addresses are automatically displayed and do not have to be set unless for some reason a different location is desired for the program. When converting to mnemonic code, it is best to start at Program Memory address 0000 unless there is a specific reason for starting elsewhere.

7–2–2

Ladder Instructions As described in 4–3–2 Ladder Instructions, the conditions on the ladder diagram correspond to LD, LD NOT, AND, AND NOT, OR, and OR NOT. Logic blocks containing various combinations of these are combined with AND LD and OR LD. These are described in 4–3–3 Logic Block Instructions. Only one word is required for each of these instructions. This is illustrated in the following diagram, which turns ON 0505 whenever both 0005 and 0006 are ON. The table of mnemonic code is also provided for this diagram.

106

Page 114

Section 7–2

Converting to Mnemonic Code 0005

Address Instruction

0006 0505

Data

0000

LD

0005

0001

AND

0006

0002

OUT

0505

All instruction lines begin with a LD or LD NOT for the first condition. LD or LD NOT is always used when an instruction line starts from the bus bar. The address of the operand bit for LR (here, 0005) is written into the data column next to LD. The data column will include any definers or bit operands in the instruction word and the operands for all other words. Notice that the data column is split into two. The left side is used to designate a data area or # (to indicate a value as a constant) and the right side is used for the address or numeric value of each. The other condition in the ladder diagram corresponds to an AND. The operand for AND is also a bit. In this case 0006, is placed on the right side. Remember, all data area addresses except for those for the IR or SR areas require designation with the appropriate prefix. The final instruction in the diagram is OUT, which turns 0505 ON or OFF depending on the execution condition. The operand bit 0505, is written in the data column. The following example requires both AND and OR instructions to convert, but does so without requiring AND LD or OR LD. We provide the diagram and corresponding mnemonic code for reference. 0000

0001

0002

0003 0500

0200

7–2–3

Address

Instruction

Data

0000

LD

0000

0001

AND

0001

0002

OR

0200

0003

AND

0002

0004

AND NOT

0003

0005

OUT

0500

Logic Block Instructions When series of conditions lie in parallel to each other or when parallel groups of conditions lie in series, it is impossible to convert them to mnemonic code using only AND and OR operations. It is thus necessary to use the two logic block instructions, AND LD and OR LD. These are introduced in 4–3–3 Logic Block Instructions. As described in 4–3–3 Logic Block Instructions, a logic block instruction logically combines execution conditions of two logic blocks or the execution condition of a logic block and the execution condition produced by another logic block instruction.

107

Page 115

Section 7–2

Converting to Mnemonic Code

To use logic block instructions, the diagram must be divided into logic blocks. Each block is coded using LD to code the first condition, and then AND LD or OR LD is used to logically combine the blocks. With both AND LD and OR LD 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 way is to code all the blocks to be combined and then code the logic block instructions to combine them, coding the instruction for the last pair of blocks first and then coding the instruction to combine each other block backward to the first block. Although either of these methods will produce exactly the same program, the second method, 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. AND LD

The following diagram requires AND LD to be converted to mnemonic code because three pairs of parallel conditions lie in series.

0000

0002

0004 0500

0001

0003

0005

The first of each pair of conditions is converted to LD with the assigned bit operand and then ORed with the other condition. The first two blocks can be coded first, followed by AND LD, the last block, and another AND LD, or the three blocks can be coded first followed by two AND LDs. The mnemonic code for both methods is shown below.

Address

Instruction

0000

0000

LD

0000

OR NOT

0001

0001

OR NOT

0001

0002

LD NOT

0002

0002

LD NOT

0002

0003

OR

0003

0003

OR

0003

0004

AND LD, 0004

LD

0004

0005

LD

0004

0005

OR

0005

0006

OR

0005

0006

AND LD, 0007

AND LD, 0007

AND LD, 0008

OUT

0500

0008

OUT

Address

Instruction

0000

LD

0001

Data

Data

0500

Again, with last 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. OR LD

108

The following diagram requires OR LD to be converted to mnemonic code because three pairs of conditions in series lie in parallel to each other.

Page 116

Section 7–2

Converting to Mnemonic Code 0000

0001 0501

0002

0003

0004

0005

The first of each pair of conditions is converted to LD with the assigned bit operand and then ANDed with the other condition. The first two blocks can be coded first, followed by OR LD, the last block, and another OR LD, or the three blocks can be coded first followed by two OR LDs. The mnemonic code for either method is shown below.

Address

Instruction

0000

0000

LD

0000

AND NOT

0001

0001

AND NOT

0001

0002

LD NOT

0002

0002

LD NOT

0002

0003

AND NOT

0003

0003

AND NOT

0003

0004

OR LD, 0004

LD

0004

0005

LD

0004

0005

AND

0005

0006

AND

0005

0006

OR LD, 0007

OR LD, 0007

OR LD, 0008

OUT

0501

0008

OUT

0501

Address

Instruction

0000

LD

0001

Data

Data

Again, with last 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 LD and OR LD

Both of the coding methods described above can also be used when using both AND LD and OR LD, as long as the number of blocks being combined does not exceed eight. The following diagram contains only two logic blocks as shown. It is not necessary to break block b down further, because it can coded directly using only AND and OR.

0000

0001

0002

0003 0501

0201

0004

Block a

Block b

109

Page 117

Section 7–2

Converting to Mnemonic Code Address

Instruction

Data

0000

LD

0000

0001

AND NOT

0001

0002

LD

0002

0003

AND

0003

0004

OR

0201

0005

OR

0004

0006

AND LD

0007

OUT, 0501

Although the following diagram is similar to the one above, block b in the diagram below cannot be coded without being broken down into two blocks combined with OR LD. In this example, the three blocks have been coded first and then OR LD has been used to combine the last two blocks followed by AND LD to combine the execution condition produced by the OR LD 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 0000

0001

0002

0003 0502

0004

0202

Block b2

Block a

110

Block b

Page 118

Section 7–2

Converting to Mnemonic Code

Complicated Diagrams

Address

Instruction

Data

0000

LD NOT

0000

0001

AND

0001

0002

LD

0002

0003

AND NOT

0003

0004

LD NOT

0004

0005

AND

0202

0006

OR LD, 0007

AND LD, 0008

OUT

0502

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. AND LD and OR LD is used to combine either, i.e., AND LD or OR LD 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. 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 LD will be coded before AND LD. 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 LD. Before AND LD can be used, however, OR LD 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 0000

0001

Block b1 0004

0005 0503

0002

0003

0006

0007

Block a2

Block b2

Block a

Block b

111

Page 119

Section 7–2

Converting to Mnemonic Code Address

Instruction

Data

0000

LD

0000

0001

AND NOT

0001

0002

LD NOT

0002

0003

AND

0003

0004

OR LD, 0005

LD

0004

0006

AND

0005

0007

LD

0006

0008

AND

0007

0009

OR LD, Blocks b1 and b2

0010

AND LD, Blocks a and b

0011

OUT

Blocks a1 and a2

0503

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

00

Block a

Block b

Block c

Block n

The following diagram requires first an OR LD and an AND LD to code the top of the three blocks, and then two more OR LDs to complete the mnemonic code.

0000

0001 0505 0002

112

0004

0005

0006

0007

0003

Page 120

Section 7–2

Converting to Mnemonic Code Address Instruction

Data

0000

LD

0000

0001

LD

0001

0002

LD

0002

0003

AND NOT

0003

0004

OR LD

––

0005

AND LD

––

0006

LD NOT

0004

0007

AND

0005

0008

OR LD

––

0009

LD NOT

0006

0010

AND

0007

0011

OR LD

––

0012

OUT

0505

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

0002

0003

0000 0505

0001

0004

0005

0006

0007

Address Instruction

Data

0000

LD

0002

0001

AND NOT

0003

0002

OR

0001

0003

AND

0000

0004

LD NOT

0004

0005

AND

0005

0006

OR LD

––

0007

LD NOT

0006

0008

AND

0007

0009

OR LD

––

0010

OUT

0505

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

113

Page 121

Section 7–2

Converting to Mnemonic Code 0000

0002

0001

0505 Block b Block a Block c 0003

Block d

0004

0005

0006

0007

Block e

Address Instruction

Data

0000

LD

0000

0001

LD

0001

0002

AND

0002

0003

LD

0003

0004

AND

0004

0005

LD

0005

0006

LD

0006

0007

AND

0007

0008

OR LD

––

Blocks d and e

0009

AND LD

––

Block c with above

0010

OR LD

––

Block b with above

0011

AND LD

––

Block a with above

0012

OUT

0505

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

0007

0003

0004

0000 0505

0005

0001

114

0002