The text of a manual · part 16 of 60
SYSMAC CQM1/CPM1/CPM1A/SRM1 Programmable Controllers Programming Manual: SECTION 2 Special Features, pages 135 to 143
Pages 135 to 143 of 520, from SYSMAC CQM1/CPM1/CPM1A/SRM1 Programmable Controllers Programming Manual
The original document is the PDF (2.1 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 CQM1-CPU21
Page 135
SECTION 2 Special Features This section provides an introduction to some of the main CQM1/CPM1/CPM1A/SRM1 features, including the instructions available through expansion instructions, a monitoring feature called differential monitoring, and the analog setting function available in the CQM1-CPU42-EV1 and CPM1/CPM1A PCs. If you are not familiar with OMRON PCs or ladder diagram program, you can skim over this section as an overview of these features, but will want to read Section 3 Memory Areas and Section 4 Ladder-diagram Programming before reading this section in detail. Also, details on programming instructions can be found in Section 5 Instruction Set. 2-1
2-2
2-3 2-4 2-5 2-6
Expansion Instructions (CQM1/SRM1 Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1-1 CQM1 Expansion Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1-2 SRM1 Expansion Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Advanced I/O Instructions (CQM1 Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2-1 TEN-KEY INPUT – TKY(18) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2-2 HEXADECIMAL KEY INPUT – HKY(––) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2-3 DIGITAL SWITCH INPUT – DSW(87) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2-4 7-SEGMENT DISPLAY OUTPUT – 7SEG(88) . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2-5 Alternate I/O Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Macro Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Differential Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Analog Settings (CQM1-CPU42-EV1/CPM1/CPM1A Only) . . . . . . . . . . . . . . . . . . . . . . . Quick-response Inputs (CPM1/CPM1A Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
116 117 117 118 118 120 122 125 127 128 129 129 131
115
Page 136
Section
Expansion Instructions (CQM1/SRM1 Only)
2-1
2-1
Expansion Instructions (CQM1/SRM1 Only) A set of expansion instructions is available for the CQM1/SRM1 to aid in special programming needs. Function codes can be assigned to up to 18 of the expansion instructions to enable using them in programs. This allows the user to pick the instructions needed by each CQM1 or SRM1 program to more effectively use the function codes required to input instructions. The mnemonics of expansion instructions are followed by “(––)” as the function code to indicate that they must be assigned function codes by the user in the instructions table before they can be used in programming (unless they are used under their default settings). Any of the instructions not assigned function codes will need to be assigned function codes in the instructions table used by the Programming Device and the CQM1 or SRM1 before they can be used in programming. The assignments of expansion instructions in the instructions table will change the meaning of instructions and operands, so be sure to set the instructions table before programming and transfer the proper instructions table to the CQM1 or SRM1 before program execution. Example: CQM1 PCs The specific instructions used in the following example are for the CQM1. The concepts are the same for the SRM1. Function code 61
INI
Function code 61
SPED
SPED Function code 64
PULS
Function code 64
MIN SUM
At the time of shipping, the function codes are assigned as shown above. (In this example, the instructions all relate to pulse outputs.)
PULS MAX
MAX Function code 65
INI
Function code 65
MIN SUM
If pulse outputs are not being used, and if maximum values, minimum values, and sums are required, then the Set Instructions operation can be used as shown above to reassign instructions in the instruction table.
Note Set the PC model to “CQM1” when setting the expansion instructions for the SRM1 or CQM1 from the SSS.
116
Page 137
Section
Expansion Instructions (CQM1/SRM1 Only)
2-1
2-1-1 CQM1 Expansion Instructions The following 18 function codes can be used for expansion instructions: 17, 18, 19, 47, 48, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 87, 88, and 89 The expansion instructions that can be used are listed below, along with the default function codes that are assigned when the CQM1 is shipped. Instructions marked with a “*” are available only in CPU Units. Mnemonic
Function code
Mnemonic
Function code
Mnemonic
Function code
ASFT
17
INT
89
ADBL*
---
TKY
18
HKY
---
SBBL*
---
MCMP
19
FPD
---
MBS*
---
RXD
47
SRCH
---
DBS*
---
TXD
48
MAX
---
MBSL*
---
CMPL
60
MIN
---
DBSL*
---
INI
61
APR
---
CPS*
---
PRV
62
LINE
---
CPSL*
---
CTBL
63
COLM
---
NEG*
---
SPED
64
SEC
---
NEGL*
---
PULS
65
HMS
---
ZCP*
---
SCL
66
SUM
---
ZCPL*
---
BCNT
67
FCS
---
XFRB*
---
BCMP
68
HEX
---
PLS2*
---
STIM
69
AVG
---
ACC*
---
DSW
87
PWM*
---
SCL2*
---
7SEG
88
PID*
---
SCL3*
---
With the CQM1, an instructions table can also be stored on Memory Cassettes when they are used. Exercise care when using a Memory Cassette that has been used with another CQM1 or SRM1 and be sure the proper instructions table is present. ! Caution
If pin no. 4 of the CQM1’s DIP switch is set to OFF, only expansion instructions on the default instructions table can be used and the user-set instructions table will be ignored. The default instructions table will also be set whenever power is turned on, deleting any previous settings. Make sure that pin 4 of the CPU Unit DIP switch is ON when reading a program from the Memory Cassette that has a user-set expansion instructions table. If pin 4 is OFF, the default instructions table will be used for expansion instructions in programs read from a Memory Cassette. (In this case, the program read from the Memory Cassette and the program on the Memory Cassette will not match when the two are compared.)
2-1-2 SRM1 Expansion Instructions The following 18 function codes can be used for expansion instructions: 17, 18, 19, 47, 48, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 87, 88, and 89 The expansion instructions that can be used are listed below, along with the default function codes that are assigned when the SRM1 is shipped. Mnemonic
Function code
ASFT
17
RXD
47
TXD
48
CMPL
60
117
Page 138
Section
Advanced I/O Instructions (CQM1 Only) Mnemonic
2-2
2-2
Function code
BCNT
67
BCMP
68
STIM
69
FCS
---
HEX
---
STUP
---
Advanced I/O Instructions (CQM1 Only) Advanced I/O instructions enable control, with a single instruction, of previously complex operations involving external I/O devices (digital switches, 7-segment displays, etc.). This section introduces advanced I/O instructions, which are also covered at the end of Section 5 Instruction Set. There are four advanced I/O instructions, as shown in the following table. All of these are expansion instructions and must be assigned to function codes before they can be used. Name
Mnemonic
Function
TEN-KEY INPUT
TKY(18)
BCD input from 10-key keypad
HEXADECIMAL KEY INPUT
HKY(––)
DIGITAL SWITCH INPUT
DSW(87)
Hexadecimal input from 16-key keypad SV input from digital switch
7-SEGMENT DISPLAY OUTPUT
7SEG(88)
BCD output to 7-segment display
2-2-1 TEN-KEY INPUT – TKY(18) This instruction inputs 8 digits in BCD from a 10-key keypad and uses 10 input points. Hardware
Prepare a 10-key keypad, and connect it so that the switches for numeric keys 0 through 9 are input to points 0 through 9 as shown in the following diagram. Either the input terminals on the CPU Unit or the inputs on a DC Input Unit with 16 or more input points can be used. ID212
0
0 1 2 3 4 5 6 7 8 9 10
9
11 12 13
10-key
14 15 COM COM
0V
DC Input Unit
118
Page 139
Section
Advanced I/O Instructions (CQM1 Only)
2-2
Using the Instruction TKY(18)
IW: Input word IW
D1: First register word
D1
D2: Key input word
D2
If the input word for connecting the 10-key keypad is specified for IW, then operation will proceed as shown below when the program is executed. IW D1+1
00 01 02
D1
Before execution
0
0
0
0
0
0
0
0
(1)
0
0
0
0
0
0
0
1
Input from 10-key to 09
“1” key input D2 (2) 00
0
0
0
0
0
01 Turn ON flags corresponding to 10-key inputs (The flags remain ON until the next input.)
02 to
0
1
0
“0” key input (3)
0
0
0
0
0
1
0
2
“2” key input
09 (4)
0
0
0
0
1
0
2
9
ON if a key is pressed.
10 (1)
(2)
(3)
Note
“9” key input
(4)
1. While one key is being pressed, input from other keys will not be accepted. 2. If more than eight digits are input, digits will be deleted beginning with the leftmost digit. 3. Input bits not used here can be used as ordinary input bits.
Application Example
In this example, a program for inputting numbers from the 10-key is shown. Assume that the 10-key is connected to IR 000. 25313 (Always ON) TKY(18) 000 DM1000 DM1002 00015 @XFER(70) #0002 DM1000 DM 0000
The 10-key information input to IR 000 using TKY(18) is converted to BCD and stored in DM 1000 and DM 1001. Key information is stored in DM 1002. IR 00015 is used as an “ENTER key,” and when IR 00015 turns ON, the data stored in DM 1000 and DM 1001 will be transferred to DM 0000 and DM 0001.
119
Page 140
Section
Advanced I/O Instructions (CQM1 Only)
2-2
2-2-2 HEXADECIMAL KEY INPUT – HKY(––) This instruction inputs 8 digits in hexadecimal from a hexadecimal keyboard. It utilizes 5 output bits and 4 input bits. Hardware
Prepare the hexadecimal keyboard, and connect the 0 to F numeric key switches, as shown below, to input points 0 through 3 and output points 0 through 3. Output point 4 will be turned ON while any key is being pressed, but there is no need to connect it. C
D
E
OD212 F
0 1
8
9
A
B
2 3
4
5
6
7
4 5
0
1
2
3
6 7 8
ID212
9
0
10
1
11 2
12
3
13
4
14
5
15 6
COM
7
COM 8
9 10 11
Output Unit 12
13 14 15 COM COM
Input Unit
The inputs can be connected to the input terminals on the CPU Unit or a DC Input Unit with 8 or more input points and the outputs can be connected from a Transistor Output Unit with 8 points or more. Using the Instruction HKY IW
IW: Input word
0W
OW: Control signal output word
D
120
D: First register word
Page 141
Section
Advanced I/O Instructions (CQM1 Only)
2-2
If the input word for connecting the hexadecimal keyboard is specified at IW, and the output word is specified at OW, then operation will proceed as shown below when the program is executed. IW 00 01 02 03 16-key 0 to 9 to F
16-key selection control signals
Status of 16 keys
D+2 00 to 09 to 15 OW 04
Turn ON flags corresponding to input keys (The flags remain ON until the next input.) ON for a 12-cycle period if a key is pressed.
0 1 2 3 4 5 6 7 8 9 101112 Once per 12 cycles 0000
0000
0000
000F
0000
00F9
D+1
D
D+1
D
D+1
D
SR 25408 will turn ON while HKY(––) is being executed. Note
1. Do not use HKY(––) more than once within the same program. 2. When using HKY(––), set the input constant for the relevant input word to less than the cycle time. (Input constants can be changed from DM 6620 onwards.) 3. While one key is being pressed, input from other keys will not be accepted. 4. If more than eight digits are input, digits will be deleted beginning with the leftmost digit. 5. Input and output bits not used here can be used as ordinary input and output bits. With this instruction, one key input is read in 3 to 12 cycles. More than one cycle is required because the ON keys can only be determined as the outputs are turned ON to test them.
Application Example
This example shows a program for inputting numbers from a hexadecimal keyboard. Assume that the hexadecimal keyboard is connected to IR 000 (input) and IR 100 (output). 25313 (Always ON) HKY 000 100 DM1000 00015 @XFER(70) #0002 DM1000 DM0000
121
Page 142
Section
Advanced I/O Instructions (CQM1 Only)
2-2
The hexadecimal key information that is input to IR 000 by HKY(––) is converted to hexadecimal and stored in words DM1000 and DM1001. IR 00015 is used as an “ENTER key,” and when IR 00015 turns ON, the numbers stored in DM 1000 and DM 1001 are transferred to DM 0000 and DM 0001.
2-2-3 DIGITAL SWITCH INPUT – DSW(87) With this instruction, 4-digit or 8-digit BCD set values are read from a digital switch. DSW(87) utilizes 5 output bits and either 4 input bits (for 4 digits) or 8 input bits (for 8 digits). Hardware
Connect the digital switch and the Input and Output Units as shown in the diagram below. In the diagram, an 8-digit input is shown. When using a 4-digit input, connect D0 through D3 from the digital switch to input points 0 through 3. In either case, output point 5 will be turned ON when one round of data is read, but there is no need to connect output point 5 unless required for the application. ID212 1 3 5 7 9 11 13 15 COM
0
Input Unit D0 D1 D2 D3 D0 D1 D2 D3 CS0 CS1 CS2 CS3 RD
2 4 6 8 10 12 14
3 5 7 9 11 13 15 COM
122
D0 D1 D2 D3 D0 D1 D2 D3 CS0 CS1 CS2 CS3 RD
A7E data line rightmost digits
A7E data line leftmost digits
Leftmost digits A7E
Rightmost digits
To A7E chip selection To A7E RD terminal
COM
Note An interface to convert signals from 5 V to 24 V is required to connect an A7E digital switch.
OD212 1
Interface
0 2 4 6 8 10 12 14 COM
Output Unit
Page 143
Section
Advanced I/O Instructions (CQM1 Only)
2-2
The following example illustrates connections for an A7B Thumbwheel Switch. ID212
Input Unit
0 1 2 3 4 5 6 7 8 9
A7B Thumbwheel Switch
10 11 12
8 4 2 1
13 14
OD212
15 COM COM
Switch no. 8
7
6
5
4
3
2
1
C
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Output Unit
DC COM
Note The data read signal is not required in the example.
The inputs can be connected to the CPU Unit’s input terminals or a DC Input Unit with 8 or more input points and the outputs can be connected from a Transistor Output Unit with 8 or more output points. Preparations
When using DSW(87), make the following setting in the PC Setup in PROGRAM mode before executing the program. Digital Switch Settings (PC Setup) Bit 15 DM6639
0
–
–
Number of digits to read 00: 4 digits 01: 8 digits Default: 4 digits
Do not make any changes to bits 0 to 7. They are not related to DSW(87). Using the Instruction DSW(87) IW OW R
IW: Input word OW: Output word R: First register word
123