The text of a manual · part 16 of 27
SYSMAC C20P/C28P/C40P/C60P P-type Programmable Controllers Operation Manual: SECTION 7, pages 122 to 131
Pages 122 to 131 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 122
Section 7–2
Converting to Mnemonic Code Address Instruction
Data
0000
LD
0006
0001
AND
0007
0002
OR
0005
0003
AND
0003
0004
AND
0004
0005
LD
0001
0006
AND
0002
0007
OR LD
––
0008
AND
0000
0009
OUT
0505
Our last example may at first appear very complicated but can be coded using only two logic block instructions. The diagram appears as follows: Block a 0000
0001
0100
0101
0002
0003
0004
0005 0505
0006
0500 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 used to combine the execution condition of block c with the execution condition resulting from the inverse condition assigned 0003. The rest of the diagram can be coded with ladder instructions. The logical flow for this and the resulting code are shown below. Block a
Block b
0000
0001
0100
0101
LD AND
0000 0001
LD AND
0100 0101
OR LD Block c 0500
0004
0005
0004 0005
LD
0500
LD AND
0002
0003
0006
LD 0002 AND NOT 0003
LD
0006
AND LD
0505
115
Page 123
Section 7–2
Converting to Mnemonic Code Address Instruction
7–2–4
Address Instruction
Data
Data
0000
LD
0000
0007
AND NOT
0003
0001
AND
0001
0008
LD
0004
0002
LD
0100
0009
AND
0005
0003
AND
0101
0010
OR
0006
0004
OR LD
––
0011
AND LD
0005
OR
0500
0012
OUT
0006
AND
0002
–– 0505
Coding Other Instructions When combining other right-hand instructions with ladder diagram instructions, they would appear in the same place as the OUTs used in the example in the preceding section. Many of these instructions, however, require more than one word to code. The first word of any instruction defines the instruction and provides any definers and sometimes bit operands required by the instruction. All other operands (i.e., operand words) are placed in words after the instruction word, one operand to a word, in the same order as these appear in the ladder symbol for the instruction. Although the SV for TIM and CNT are written to the left of the symbol on the same line as the instruction, these are the only instructions for which one line in the ladder symbol must be coded as two words (i.e., two lines) in the mnemonic code. Also the TC number for TIMH(15) is placed on a second line even though it is part of the instruction word. For all other instructions, each line of the ladder diagram will go into one word of mnemonic code. The address and instruction columns of the mnemonic code table are filled in for the instruction word only. For all other words, the left two columns are left blank. If the instruction word requires no definer or bit operand, the data column for it is left blank. It is a good idea to cross though the blank data column for all instruction words not requiring data so that the data column can be quickly scanned to see if any addresses have been left out. If an IR or SR address is used in the data column, the left side of the column is left blank. If any other data area is used, the data area abbreviation is placed on the left side and the address is place on the right side. If a constant is to be input, the number symbol (#) is placed on the left side of the data column and the number to be input is placed on the right side. Any numbers input as definers in the instruction word do not require the number symbol on the right side. Remember, TR bits, once defined as a timer or counter, take a TIM (timer) or CNT (counter) prefix. When coding an instruction that has a function code, be sure to write in the function code, which will be necessary when inputting the instruction. The following diagram and corresponding mnemonic code illustrate the points described above.
116
Page 124
Section 7–2
Converting to Mnemonic Code 0000
Address Instruction
0001 DIFU(13) 1500 0002
0100
0200
1500 ADD(30)
0101
0102
1505
#0001 0004 HR 0
00005 TIM 00
Data
0000
LD
0000
0001
AND
0001
0002
OR
0002
0003
DIFU(13)
1500
0004
LD
0100
0005
AND NOT
0200
0006
LD
0101
0007
AND NOT
0102
0008
AND NOT
1505
0009
OR LD
––
0010
AND
1500
0011
ADD(30)
# 15.0
––
TIM 00
# MOV(21)
0001 0004
HR 0
HR
HR 2
HR 015
0012
LD
0005
0013
TIM
00
0500
Multiple Instruction Lines
0
0014
LD
0015
MOV(21)
#
0150
TIM
00 ––
0016
LD
0017
OUT NOT
HR
0
HR
2
HR
015 0500
If a right-hand instruction requires multiple instruction lines, all of the lines for the instruction are coded before the right-hand instruction. Each of the lines for the instruction are coded starting with LD or LD NOT to form ‘logic blocks’ that are combined by the right-hand instruction. An example of this for CNTR(12) is shown below.
0000
0001
I CNTR(12)
0002
P 01
0100
0101
0200
0102
1500
R
#5000
1501
HR 015 0500
117
Page 125
Section 7–2
Converting to Mnemonic Code Address Instruction
Data
0000
LD
0000
0001
AND
0001
0002
LD
0002
0003
LD
0100
0004
AND NOT
0200
0005
LD
0101
0006
AND NOT
0102
0007
AND NOT
1501
0008
OR LD
––
0009
AND
1500
0010
CNTR(12)
–– 01 #
Multiple Right-hand Instructions
0011
LD
0012
OUT NOT
5000
HR
015 0500
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. 0000
0003
HR 001
0001
TIM 02
0002
TIM 01 0506
HR 000
118
Address
Instruction
0000
LD
0000
0001
OR
0001
0002
OR
0002
0003
OR
0004
AND
0005
OUT
0006
TIM
0007
AND
0008
OUT
Data
HR
0000 0003
HR
01 02
#
0100
TIM
01 0506
001.0s
Page 126
Section 7–2
Converting to Mnemonic Code TR Bits
TR bits in a program are used to output (OUT) the execution condition at the branching point and then to load back (LD) the execution condition when it is required after returning to the branch lines. Within any one instruction block, OUT cannot be used with the same TR address. The same TR address can, however, be used with LD as many times as required. The following example shows an instruction block using two TR bits. TR 1 is used in LD once; TR 0, twice.
TR 0 0000
TR 1 0001
0002 0500
0003 0501
0004 0502
0005 0503
Address
Instruction
Data
0000
LD
0001
OUT
0002
AND
0003
OUT
0004
AND
0002
0005
OUT
0500
0006
LD
0007
AND
0003
0008
OUT
0501
0009
LD
0010
AND
0004
0011
OUT
0502
0012
LD
0013
AND NOT
0005
0014
OUT
0503
0000 TR
0 0001
TR
TR
TR
TR
1
1
0
0
If the condition assigned 0004 was not in the diagram, the second LD using TR 0 would not be necessary because OUT with 0502 and the AND NOT with 0005 both require the same execution condition, i.e., the execution condition stored in TR 0. The diagram and mnemonic code for this program are shown below.
119
Page 127
Section 7–2
Converting to Mnemonic Code TR 0 0000
TR 1 0001
0002 0500
0003 0501
0502
0005 0503
Interlocks
120
Address
Instruction
Data
0000
LD
0001
OUT
0002
AND
0003
OUT
0004
AND
0002
0005
OUT
0500
0006
LD
0007
AND
0003
0008
OUT
0501
0009
LD
0010
OUT
0502
0011
AND NOT
0005
0012
OUT
0503
0000 TR
0 0001
TR
TR
TR
1
1
0
When coding IL(02) and ILC(03), the mnemonic code will be the same regardless of whether the instruction is drawn as branching instruction lines or whether IL(02) is placed on its own instruction line. If drawn as branching instruction lines, each branch line is coded as if it were connected to the bus bar, i.e., the first condition on each branch line corresponds to a LD or LD NOT instruction.
Page 128
Section 7–3
The Programming Console IL(02)
0000
0001 0500
IL(02)
0002
0003
0004 0501
0005 0502
0006 0503
ILC(03)
Address Instruction LD
0000
0001
IL(02)
––
0002
LD
0001
0003
OUT
0200
0004
LD
0002
0005
IL(02)
––
0006
LD
0003
0007
AND NOT
0004
0008
OUT
0201
0009
LD
0005
0010
OUT
0202
0011
LD
0006
0012
OUT
0203
0013
ILC(03)
––
When you have finished coding the program, make sure you have placed END(01) at the last address.
END(01)
7–3
Data
0000
The Programming Console Depending on the model of Programming Console used, it is either connected to the CPU via a Programming Console Adapter and Connecting Cable or it is mounted directly to the CPU. Refer to the Programming Console Operation Guide for details.
7–3–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.
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
121
Page 129
The Programming Console
Section 7–3 programming operations. Any Programming Console operation can be cancelled 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.) The gray keys other than the SHIFT key have either the mnemonic name of the instruction or the abbreviation of the data area written on them. The functions of these keys are described below.
122
Page 130
Section 7–3
The Programming Console
Pressed before the function code when inputting an instruction via its function code. Pressed to enter SFT (the Shift Register instruction). Input after a ladder instruction to designate an inverse condition. Pressed to enter AND (the AND instruction) or used with NOT to enter AND NOT. Pressed to enter OR (the OR instruction) or used with NOT to enter OR NOT. Pressed to enter CNT (the Counter instruction) or to designate a TC number that has already been defined as a counter. Pressed to enter LD (the Load instruction) or used with NOT to enter LD NOT. Also pressed to indicate an input bit. Pressed to enter OUT (the Output instruction) or used with NOT to enter OUT NOT. Also pressed to indicate an output bit. Pressed to enter TIM (the Timer instruction) or to designate a TC number that has already been defined as a timer. Pressed before designating an address in the TR area. Pressed before designating an address in the LR area. Cannot be used with the P-type PCs. Pressed before designating an address in the HR area. Pressed before designating an address in the DM area. Pressed before designating an indirect DM address. Cannot be used with the P-type PCs. Pressed before designating a word address. Pressed before designating an operand as a constant. Pressed before designating a bit address.
7–3–2
PC Modes The Programming Console is equipped with a switch to control the PC mode. To select one of three operating modes - RUN, MONITOR, or PROGRAM - use the mode switch. The mode that you select will determine PC operation as well as the procedures that are possible from the Programming Console. RUN mode is the mode used for normal program execution. When the switch is set to RUN and the START input on the CPU Power Supply Unit is ON, the CPU will begin executing the program according to the program written in its Program Memory. Although monitoring PC operation from the Programming Console is possible in RUN mode, no data in any of the memory areas can be input or changed.
123
Page 131
Section 7–4
Preparation for Operation
MONITOR mode allows you to visually monitor in-progress program execution while controlling I/O status, changing PV (present values) or SV (set values), etc. In MONITOR mode, I/O processing is handled in the same way as in RUN mode. MONITOR mode is generally used for trial system operation and final program adjustments. In PROGRAM mode, the PC does not execute the program. PROGRAM mode is for creating and changing programs, clearing memory areas, and registering and changing the I/O table. A special Debug operation is also available within PROGRAM mode that enables checking a program for correct execution before trial operation of the system. ! WARNING Do not leave the Programming Console connected to the PC by an extension cable when in RUN mode. Noise entering via the extension cable can affect the program in the PC and thus the controlled system. Mode Changes
When the PC is turned on, the mode it is in will depend on what Peripheral Device, if any, is connected or mounted to the CPU. • No Peripheral Device Connected When power is applied to the PC without a Peripheral Device connected, the PC is automatically set to RUN mode. Program execution is then controlled through the CPU Power Supply Unit’s START terminal. • Programming Console Connected If the Programming Console is connected to the PC when PC power is applied, the PC is set to the mode set on the Programming Console’s mode switch. • Other Peripheral Connected If a Peripheral Interface Unit, PROM Writer, Printer Interface Unit, or a Floppy Disk Interface Unit is attached to the PC when PC power is turned on, the PC is automatically set to PROGRAM mode. If the PC power supply is already turned on when a peripheral device is attached to the PC, the PC will stay in the same mode it was in before the peripheral device was attached. The mode can be changed with the mode switch on the Programming Console once the password has been entered. If it is necessary to have the PC in PROGRAM mode, (for the PROM Writer, Floppy Disk Interface Unit, etc.), be sure to select this mode before connecting the peripheral device, or alternatively, apply power to the PC after the peripheral device is connected. The mode will also not change when a Peripheral Device is removed from the PC after PC power is turned on.
! WARNING Always confirm that the Programming Console is in PROGRAM mode when turning on the PC with a Programming Console connected unless another mode is desired for a specific purpose. If the Programming Console is in RUN mode when PC power is turned on, any program in Program Memory will be executed, possibly causing any PC-controlled system to begin operation. Also be sure that starting operation is safe and appropriate whenever turning on the PC without a device mounted to the CPU when the START input on the CPU Power Supply Unit is ON.
7–4
Preparation for Operation This section describes the procedures required to begin Programming Console operation. These include password entry, clearing memory, and error message clearing. The following sequence of operations must be performed before beginning initial program input.
124