The text of a manual · part 12 of 60
SYSMAC CQM1/CPM1/CPM1A/SRM1 Programmable Controllers Programming Manual: SECTION 1 PC Setup and Other Features, pages 101 to 110
Pages 101 to 110 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 101
Section
CPM1/CPM1A Interrupt Functions
1-6
To start comparisons again, set the second operand to “000” (execute comparison), and execute the INI(61) instruction. Once a table has been saved, it will be retained in the CPM1/CPM1A during operation (i.e., during program execution) as long as no other table is saved. Reading the PV There are two ways to read the PV. The first is to read it from SR 248 and SR 249, and the second to use the PRV(62) instruction. Reading SR 248 and SR 249 The PV of high-speed counter is stored in SR 248 and SR 249 as shown below. The leftmost bit will be F for negative values.
Note
Leftmost 4 digits
Rightmost 4 digits
Up/Down Mode
Incrementing Mode
SR 249
SR 248
F0032767 to 00032767 (–32767)
00000000 to 00065535
1. These words are refreshed only once every cycle, so there may be a difference from the actual PV. 2. When high-speed counter is not being used, the bits in these words can be used as work bits. Using the PRV(62) Instruction Read the PV of the high-speed counter by using the PRV(62) instruction. (@)PRV(62)
P1: Leading word of PV
000 000 P1
The PV of the high-speed counter is stored as shown below. The leftmost bit will be F for negative values. Leftmost 4 digits P1+1
Rightmost 4 digits P1
Up/Down Mode
Incrementing Mode
F0032767 to 00032767 (–32767)
00000000 to 00065535
The PV is read when the PRV(62) instruction is actually executed. Changing the PV There are two ways to change the PV of high-speed counter. The first way is to reset it by using the reset methods. (In this case the PV is reset to 0.) The second way is to use the INI(61) instruction. The method using the INI(61) instruction is explained here. For an explanation of the reset method, refer to the beginning of this description of high-speed counter. Change the timer PV by using the INI(61) instruction as shown below. (@)INI(61)
D: Leading word for storing PV change data 000 002 D
Leftmost 4 digits Rightmost 4 digits D+1
D
Up/Down Mode
Incrementing Mode
F0032767 to 00032767
00000000 to 00065535
To specify a negative number in up/down mode, set F in the leftmost digit. Application Example (Incrementing Mode)
This example shows a program that uses the high-speed counter with singlephase inputs in the Incrementing Mode, making comparisons by means of the target matching method.
81
Page 102
Section
CPM1/CPM1A Interrupt Functions
1-6
The comparison conditions (target values and count directions) are stored in the comparison table with the subroutine numbers. Up to 16 target values can be stored. The corresponding subroutine is executed when the counter’s PV matches the target value. The following data is stored for the comparison table: DM 0000 0002 Number of comparison conditions: 2 DM 0001 1000 Target value 1: 1000 DM 0002 0000 DM 0003 0030 Comparison 1 interrupt subroutine no.: 30 DM 0004 2000 Target value 2: 2000 DM 0005 0000 DM 0006 0031 Comparison 2 interrupt subroutine no.: 31 The following diagram shows the example ladder program. DM 6642 must be set to where is the reset method which can be set to 0 or 1. 25315 (ON for first cycle) CTBL(63) 000 000 DM 0000
SBN(92)
Registers comparison table, target value mode First word of the comparison table
030
Interrupt program 30 RET(93)
SBN(92)
031
Interrupt program 31 RET(93)
Application Example (Up/Down Mode)
This example shows a program that uses the high-speed counter with phase-difference inputs in the Up/Down Mode, making comparisons by means of the range comparison method. The comparison conditions (upper/lower limits of the ranges) are stored in the comparison table with the subroutine numbers. Up to 8 separate ranges can be defined. The corresponding subroutine is executed when the counter’s PV is within the range. Note Always set 8 ranges. If fewer than 8 ranges are needed, set the remaining subroutine numbers to FFFF. A value of FFFF indicates that no subroutine is to be executed. The following data is stored for the comparison table: DM 0000 1500 DM 0001 0000 Lower limit 1: 1,500 counts DM 0002 3000 DM 0003 0000 Upper limit 1: 3,000 counts DM 0004 0040 Range 1 interrupt subroutine no.: 40 DM 0005 7500 DM 0006 0000 Lower limit 2: 7,500 counts DM 0007 0000 DM 0008 0001 Upper limit 2: 10,000 counts DM 0009 0041 Range 2 interrupt subroutine no.: 41 DM 0010 0000 DM 0011 0000
82
Page 103
Section
SRM1 Interrupt Functions DM 0012 DM 0013 DM 0014 . . . . . DM 0035 DM 0036 DM 0037 DM 0038 DM 0039
0000 0000 FFFF . . . . . 0000 0000 0000 0000 FFFF
1-7
Range 3 interrupt subroutine not executed . . . . .
Range 8 interrupt subroutine not executed
The following diagram shows the example ladder program. DM 6642 must be set to where is the reset method which can be set to 0 or 1. 25315 (ON for first cycle) CTBL(63) 000 001 DM 0000
SBN(92)
Registers comparison table, range comparison mode First word of the comparison table
040
Interrupt program 40 RET(93)
SBN(92)
041
Interrupt program 41 RET(93)
1-7
SRM1 Interrupt Functions This section explains the settings and methods for using the SRM1 interrupt functions.
1-7-1 Types of Interrupts The SRM1 has only one type of interrupt processing, as outlined below. Interval Timer Interrupts Interrupt processing is executed by an interval timer with a precision of 0.1 ms.
1-7-2 Interval Timer Interrupts The SRM1 is equipped with one interval timer. When the interval timer times out, the main program is interrupted and the interrupt program is executed immediately, regardless of the point in the cycle. There are two modes for interval timer operation, the One-shot Mode, in which only one interrupt will be executed when time expires, and the Scheduled Interrupt Mode in which the interrupt is repeated at a fixed interval. The interval timer’s set value can be set anywhere from 0.5 to 319968 ms, in units of 0.1 ms.
83
Page 104
Section
SRM1 Interrupt Functions Operation
1-7
Use the following instruction to activate and control the interval timer. Starting Up in One-Shot Mode Use the STIM(69) instruction to start the interval timer in the one-shot mode. (@)STIM(69) C1 C2 C3
1, 2, 3...
C3: Subroutine no. (4 digits BCD): 0000 to 0049
1. When C2 is entered as a word address: C2: Decrementing counter set value (4 digits BCD): 0000 to 9999 C2 + 1: Decrementing time interval (4 digits BCD; unit: 0.1 ms): 0005 to 0320 (0.5 ms to 32 ms) Each time that the interval specified in word C2 + 1 elapses, the decrementing counter will decrement the present value by one. When the PV reaches 0, the designated subroutine will be called just once and the timer will stop. The time from when the STIM(69) instruction is executed until time elapses is calculated as follows: (Content of C2) × (Content of C2 + 1) × 0.1 ms = (0.5 to 319,968 ms) 2. When C2 is entered as a constant: The set value of the decrementing counter will equal the specified constant (in ms) and the decrementing time interval will be 10 (1 ms). Starting Up in Scheduled Interrupt Mode Use the STIM(69) instruction to start the interval timer in the scheduled interrupt mode. (@)STIM(69) C1 C2 C3
1, 2, 3...
C1: Interval timer, one-shot mode (000) C2: Timer set value (first word address)
C1: Interval timer, scheduled interrupt mode (003) C2: Timer set value (leading word no.) C3: Subroutine no. (4 digits BCD): 0000 to 0049
1. When C2 is entered as a word address: C2: Decrementing counter set value (4 digits BCD): 0000 to 9999 C2 + 1: Decrementing time interval (4 digits BCD; unit: 0.1 ms): 0005 to 0320 (0.5 ms to 32 ms) The meanings of the settings are the same as for the one-shot mode, but in the scheduled interrupt mode the timer PV will be reset to the set value and decrementing will begin again after the subroutine has been called. In the scheduled interrupt mode, interrupts will continue to be repeated at fixed intervals until the operation is stopped. 2. When C2 is entered as a constant: The settings are the same as for the one-shot mode, but interrupts will continue to be repeated at fixed intervals until the operation is stopped. Reading the Timer’s Elapsed Time Use the STIM(69) instruction to read the timer’s elapsed time. (@)STIM(69) C1 C2 C3
C1: Read elapsed time (006) C2: Leading word of parameter 1 C3: Parameter 2
C2: Number of times the decrementing counter has been decremented (4 digits BCD) C2 + 1: Decrementing counter time interval (4 digits BCD; unit: 0.1 ms) C3: Elapsed time from previous decrement (4 digits BCD; unit: 0.1 ms)
84
Page 105
Section
SRM1 Interrupt Functions
1-7
The time from when the interval timer is started until the execution of this instruction is calculated as follows: {(Content of C2) × (Content of C2+1) + (Content of C3)} × 0.1 ms If the specified interval timer is stopped, then “0000” will be stored. Stopping the Timer Use the STIM(69) instruction to stop the interval timer. The interval timer will be stopped. (@)STIM(69) C1
C1: Stop interval timer (010)
000 000
Application Example (One-shot Mode)
In this example, an interrupt is generated 2.4 ms (0.6 ms × 4) after input 00005 goes ON; the interrupt executes interrupt subroutine number 23. 25315 First Cycle Flag ON for 1 cycle MOV(21) #0004 DM 0010
Sets the decrementing counter‘s set value to 4. (BCD: 0000 to 9999)
MOV(21) #0006 DM 0011
Sets the decrementing time interval to 0.6 ms. (BCD: 0005 to 0320)
00005 @STIM(69) 000
SBN(92)
Starts the interval timer in one-shot mode.
DM 0010
Specifies the first word containing the set value.
#0023
Specifies the subroutine number (only lower bytes are effective).
023
Interrupt program RET(93)
85
Page 106
Section
CompoBus/S Distributed I/O Functions (SRM1 Only) Application Example (Scheduled Interrupt Mode)
1-8
In this example, an interrupt is generated every 4.0 ms (1.0 ms × 4) after input 00005 goes ON; the interrupts execute interrupt subroutine number 23.
25315 First Cycle Flag ON for 1 cycle MOV(21) #0004 DM 0010
Sets the decrementing counter‘s set value to 4. (BCD: 0000 to 9999)
MOV(21) #0010 DM 0011
Sets the decrementing time interval to 1.0 ms. (BCD: 0005 to 0320)
00005 @STIM(69) 003 DM 0010 #0023
SBN(92)
Starts the interval timer in scheduled interrupt mode. Specifies the first word containing the set value. Specifies the subroutine number (only the lower bytes are effective).
023
Interrupt program RET(93)
1-8
CompoBus/S Distributed I/O Functions (SRM1 Only)
No. of Connected Nodes
A maximum of either 16 or 32 CompoBus/S nodes may be connected. No. of nodes set
Communications response time
32
0.8 ms
16
0.5 ms
The maximum no. of nodes can be set from a Programming Device by making the following settings in DM 6603. Word Bit(s) DM 6603 00 to 03
Function Sets the maximum no. of CompoBus/S nodes to either 16 or 32.
Setting 00 or 01
00: 32 nodes 01: 16 nodes 04 to 15
Not used.
00
Note When changes are made to these settings, always turn the power off and on again to make the new setting effective. Slave Interrupts
Input bits in IR 000 to IR 007 and output bits in IR 010 to IR 017 are used as interrupts for CompoBus/S I/O Terminals. The CompoBus/S I/O Terminal interrupts (IN 0 to 15 and OUT 0 to 15) are allocated as indicated in the following table. IN0 to IN15 are the node addresses for the Input Terminals and OUT0 to OUT15 are the node addresses for the Output Terminals.
86
Page 107
Section
Communications Functions Bit
Word Input
Output
Note
Status Flags Word AR04
1-9
15 14 13 12 11 10 9 IN1 IN3 IN5 IN7 IN9 IN11 IN13 IN15 OUT1 OUT3 OUT5 OUT7 OUT9 OUT11 OUT13 OUT15
IR 000 IR 001 IR 002 IR 003 IR 004 IR 005 IR 006 IR 007 IR 010 IR 011 IR 012 IR 013 IR 014 IR 015 IR 016 IR 017
8
7
6
5
4 3 2 IN0 IN2 IN4 IN6 IN8 IN10 IN12 IN14 OUT0 OUT2 OUT4 OUT6 OUT8 OUT10 OUT12 OUT14
1
0
1. When the maximum number of CompoBus/S nodes is set to 16, IN8 to IN15 can be used as work bits. 2. CompoBus/S Terminals with less than 8 points are allocated bit addresses from either 0 or 8. 3. CompoBus/S Terminals with 16 points can be set for only even number addresses. The communications status between CompoBus/S terminals is output through AR04 to AR07 Slave Add Flags and Slave Communications Error Flags.
Uppermost bits: Slave Communications Error Flags
Lower Bits: Slave Add Flags
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
OUT 7
OUT 6
OUT 5
OUT 4
OUT 3
OUT 2
OUT 1
OUT 0
OUT 7
OUT 6
OUT 5
OUT 4
OUT 3
OUT 2
OUT 1
OUT 0
AR05
IN7
IN6
IN5
IN4
IN3
IN2
IN1
IN0
IN7
IN6
IN5
IN4
IN3
IN2
IN1
IN0
AR06
OUT 15
OUT 14
OUT 13
OUT 12
OUT 11
OUT 10
OUT 9
OUT 8
OUT 15
OUT 14
OUT 13
OUT 12
OUT 11
OUT 10
OUT 9
OUT 8
AR07
IN15
IN14
IN13
IN12
IN11
IN10
IN9
IN8
IN15
IN14
IN13
IN12
IN11
IN10
IN9
IN8
Note
1. IN0 to IN15 are the input terminals and OUT0 to OUT15 are the output terminals. 2. When the maximum number of CompoBus/S units is set to 16, IN8 to IN15 and OUT8 to OUT15 cannot be used. 3. The Slave Add Flag turns ON when a slave joins the communications. When the power to the CPU Unit is turned OFF and ON again all bits will turn OFF. 4. The Slave Communications Error Flag turns ON when a slave participating in the network is separated from the network. The bit will turn OFF when the slave re-enters the network.
1-9
Communications Functions
CQM1 Communications
The following types of communications can be executed through the ports of the CQM1. • Host link communications with a host computer • RS-232C communications with a computer or other device • One-to-one link communications with another CQM1
87
Page 108
Section
Communications Functions
1-9
Note These types of communications cannot be carried out with the CQM1-CPU11-E, which is equipped with only a peripheral port. This section explains the required PC Setup and methods for using these types of communications. CPM1/CPM1A Communications
The CPM1/CPM1A can execute a variety of communications through its peripheral port via an RS-232C Adapter or an RS-422 Adapter. Host Link Communications The CPM1/CPM1A PCs are compatible with the Host Link System, which allows up to 32 PCs to be controlled from a host computer. An RS-232C Adapter is used for 1-to-1 communications and an RS-422 Adapter and B500-AL004 Link Adapter are used for 1-to-n communications. A CPM1/CPM1A equipped with an RS-232C Adapter can also communicate with a Programmable Terminal using host link commands. Refer to 1-9-4 CPM1/CPM1A Host Link Communications in this manual and 1-2-2 Host Link Communications in the CPM1 Operation Manual or 1-2-2 Host Link Communications in the CPM1A Operation Manual for more details. 1-to-1 Link A data link can be created with a data area in another CPM1, CPM1A, CQM1, or C200HS PC. An RS-232C Adapter is used to make the 1-to-1 connection. Refer to 1-9-8 CPM1/CPM1A One-to-one Link Communications in this manual and 1-2-3 1-to-1 Communications Links in the CPM1 Operation Manual or 1-2-3 1-to-1 Communications Links in the CPM1A Operation Manual for more details. NT Link Using the NT link, the CPM1/CPM1A PC can connected to the Programmable Terminal (NT Link Interface) through an RS-232C Adapter. Refer to 1-9-9 CPM1/CPM1A NT Link Communications in this manual and 1-2-4 NT Link Communications in the CPM1 Operation Manual or NT Link Communications in the CPM1A Operation Manual for more details.
SRM1 Communications
The following types of communications can be executed through the ports of the SRM1. • Host link communications with a host computer • RS-232C communications with a computer or other device • One-to-one link communications with another SRM1 • NT Link communications with Programmable Terminals Note NT Link communications are not possible with the SRM1-C01, which is equipped with only a peripheral port. The SRM1-C01 may be connected to a PT through an RS-232C Adapter in Host Link mode.
1-9-1 CQM1 PC Setup The PC Setup parameters in DM 6645 through DM 6654 are used to set parameters for the communications ports. The parameters for the RS-232C port in DM 6645 through DM 6649 can be set from menu operations using the SSS. If pin 5 on the CQM1’s DIP switch is turned ON, the PC Setup communications parameters will be ignored and the following parameters will be used. Mode: Host link Node number: 00 Start bits: 1 bit Data length: 7 bits Stop bits: 2 bit Parity: Even Baud rate: 9,600 bps Transmission delay: None
88
Page 109
Section
Communications Functions
1-9
Note The above setting apply to CPU Units manufactured from July 1995 (lot number **75 for July 1995). For CPU Units manufactured before July 1995 (lot number **65 for June 1995), only 1 stop bit will be set and the baud rate will be 2,400 bps. The settings in DM 6645 and DM 6650 determine the main communications parameters, as shown in the following diagram. Bit 15
0
DM 6645: RS-232C port DM 6650: Peripheral port Communications mode 0: Host link 1: RS-232C 2: One-to-one link slave 3: One-to-one link master 4: One-to-one NT Link (See note.) Link words for one-to-one link 0: LR 00 to LR 63 1: LR 00 to LR 31 2: LR 00 to LR 16 Port settings 00: Standard communication conditions 01: According to setting in DM 6646, DM 6651 Default: Host link using standard parameters Note: A 1:1 NT Link cannot be used with the RS-232C port on the CQM1-CPU21-E or peripheral port.
One-to-one Links To use a 1:1 link, the only settings necessary are the communications mode and the link words. Set the communications mode for one of the PCs to the 1:1 master and the other to the 1:1 slave, and then set the link words in the PC designated as the master. Bits 08 to 11 are valid only for the master for link one-to-one. Note One-to-one link communications are possible for the RS-232C port only. This setting is not possible for the peripheral port. A 1:1 NT Link cannot be used with the CQM1-CPU21-E.
Host Link Node Number A node number must be set for host link communications to differentiate between nodes when multiple nodes are participating in communications. This setting is required only for host link communications. To use host link communications, the host link must be specified as the communications mode and the communications parameters must be set (see following section). Bit 15 DM 6648: RS-232C port DM 6653: Peripheral port
0
0
0
Node number (2 digits BCD): 00 to 31 Default: 00
Set the node number to 00 unless multiple nodes are connected in a network.
RS-232C Start and End Codes and Data Received Start and end codes or the amount of data to be received can be set as shown in the following diagrams if required for RS-232C communications. This setting is required only for RS-232C communications. To use RS-232C communications, the RS-232C must be specified as the communications mode and the communications parameters must be set (see next section).
89
Page 110
Section
Communications Functions
1-9
Enabling Start and End Codes DM 6648: RS-232C port DM 6653: Peripheral port
Bit
15
0
0
0
End code 0: Not set (Amount of reception data specified.) 1: Set (End code specified.) 2: CR/LF Start code 0: Not set 1: Set (Start code specified.) Defaults: No start code; data reception complete at 256 bytes.
Specify whether or not a start code is to be set at the beginning of the data, and whether or not an end code is to be set at the end. Instead of setting the end code, it is possible to specify the number of bytes to be received before the reception operation is completed. Both the codes and the number of bytes of data to be received are set in DM 6649 or DM 6654. Setting the Start Code, End Code, and Amount of Reception Data Bit 15
0
DM 6649: RS-232C port DM 6654: Peripheral port
End code or number of bytes to be received For end code: (00 to FF) For amount of reception data: 2 digits hexadecimal, 00 to FF (00: 256 bytes) Start code 00 to FF Defaults: No start code; data reception complete at 256 bytes.
Host Link and RS-232C Communications Parameters Select either host link or RS-232C communications and then set the communications parameters as described next. Match the communications conditions to the settings at the device with which communications are being carried out. Standard Communications
If the following settings are satisfactory for these communications conditions, then set the two rightmost digits to 00. The settings in DM 6646 and DM 6651 will be ignored for this setting. Start bits: 1 bit Data length: 7 bits Stop bits: 2 bits Parity: Even Baud rate: 9,600 bps
Setting Communications Conditions Bit 15 DM 6646: RS-232C port DM 6651: Peripheral port
Transmission Frame Format (See table below.) Baud rate (See table below.) Default: Standard communication conditions.
90
0