The text of a manual · part 37 of 60
SYSMAC CQM1/CPM1/CPM1A/SRM1 Programmable Controllers Programming Manual: SECTION 5 Instruction Set, pages 339 to 348
Pages 339 to 348 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 339
Section 5-26
Special Instructions
Indirectly addressed DM word is non-existent. (Content of DM word is not BCD, or the DM area boundary has been exceeded.) EQ:
ON when the result is 0.
5-26-6 FRAME CHECKSUM – FCS(––) Operand Data Areas
Ladder Symbols FCS(––)
@FCS(––)
C
C
R1
R1
D
D
C: Control data IR, SR, AR, DM, HR, LR, # R1: First word in range IR, SR, AR, DM, HR, TC, LR D: First destination word IR, SR, AR, DM, HR, LR
Limitations
This instruction is available in the CQM1/SRM1 only. The 3 rightmost digits of C must be BCD between 001 and 999. DM 6143 to DM 6655 cannot be used for D.
Description
FCS(––) can be used to check for errors when transferring data through communications ports. When the execution condition is OFF, FCS(––) is not executed. When the execution condition is ON, FCS(––) calculates the frame checksum of the specified range by exclusively ORing either the contents of words R1 to R1+N–1 or the bytes in words R1 to R1+N–1. The frame checksum value (hexadecimal) is then converted to ASCII and output to the destination words (D and D+1). The function of bits in C are shown in the following diagram and explained in more detail below. C:
15 14 13 12 11
00 Number of items in range (N, BCD) 001 to 999 words or bytes First byte (when bit 13 is ON) 1 (ON): Rightmost 0 (OFF): Leftmost
Not used. Set to zero.
Calculation units 1 (ON): Bytes 0 (OFF): Words
Number of Items in Range
The number of items within the range (N) is contained in the 3 rightmost digits of C, which must be BCD between 001 and 999.
Calculation Units
The frame checksum of words will be calculated if bit 13 is OFF and the frame checksum of bytes will be calculated if bit 13 is ON. If bytes are specified, the range can begin with the leftmost or rightmost byte of R1. The leftmost byte of R1 will not be included if bit 12 is ON. R1 R1+1 R1+2 R1+3
MSB LSB 1 2 3 4 5 6 7 8
321
Page 340
Section 5-26
Special Instructions
When bit 12 is OFF the bytes will be ORed in this order: 1, 2, 3, 4, .... When bit 12 is ON the bytes will be ORed in this order: 2, 3, 4, 5, .... Conversion to ASCII
The byte frame checksum calculation yields a 2-digit hexadecimal value which is converted to its 4-digit ASCII equivalent. The word frame checksum calculation yields a 4-digit hexadecimal value which is converted to its 8-digit ASCII equivalent, as shown below. Byte frame checksum value
Word frame checksum value
4A
F10B
D 3 4 4 1
D 4 6 3 1
D+1 3 0 4 2
Indirectly addressed DM word is non-existent. (Content of DM word is not BCD, or the DM area boundary has been exceeded.) The number of items is not 001 to 999 BCD.
Flags
ER:
Example
When IR 00000 is ON in the following example, the frame checksum (0008) is calculated for the 8 words from DM 0000 to DM 0007 and the ASCII equivalent (30 30 30 38) is written to DM 0010 and DM 0011. 00000 @FCS(––) #0008 DM 0000
Address
Instruction
00000 00001
LD @FCS(––)
Operands 00000 # DM DM
DM 0010
DM 0000 DM 0001 DM 0002 DM 0003 DM 0004 DM 0005 DM 0006 DM 0007
0001 0002 0003 0004 0005 0006 0007 0008
0008 0000 0010
FCS calculation 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
0
0
8 ASCII code conversion
DM 0010 3 0 3 0
DM 0011 3 0 3 8
5-26-7 FAILURE POINT DETECTION – FPD(––) Ladder Symbols
Operand Data Areas C: Control data
FPD(––) # C T: Monitoring time (BCD) T D
IR, SR, AR, DM, HR, TC. LR, # D: First register word IR, SR, AR, DM, HR, LR
Limitations
322
This instruction is available in the CQM1 only. D and D+8 must be in the same data area when bit 15 of C is ON. DM 6144 to DM 6655 cannot be used for T or D. C must be input as a constant.
Page 341
Section 5-26
Special Instructions Description
FPD(––) can be used in the program as many times as desired, but each must use a different D. It is used to monitor the time between the execution of FPD(––) and the execution of a diagnostic output. If the time exceeds T, an FAL(06) nonfatal error will be generated with the FAL number specified in C. The program sections marked by dashed lines in the following diagram can be written according to the needs of the particular program application. The processing programming section triggered by CY is optional and can used any instructions but LD and LD NOT. The logic diagnostic instructions and execution condition can consist of any combination of NC or NO conditions desired. Execution condition
Branch FPD(––)(50) C T D SR 25504 (CY Flag) Processing after error detection.
Logic diagnostic instructions
Diagnostic output
When the execution condition is OFF, FPD(––) is not executed. When the execution condition is ON, FPD(––) monitors the time until the logic diagnostics condition goes ON, turning ON the diagnostic output. If this time exceeds T, the following will occur: 1, 2, 3...
Control Data
1. An FAL(06) error is generated with the FAL number specified in the first two digits of C. If 00 is specified, however, an error will not be generated. 2. The logic diagnostic instructions are searched for the first OFF input condition and this condition’s bit address is output to the destination words beginning at D. 3. The CY Flag (SR 25504) is turned ON. An error processing program section can be executed using the CY Flag if desired. 4. If bit 15 of C is ON, a preset message with up to 8 ASCII characters will be displayed on the Peripheral Device along with the bit address mentioned in step 2. The function of the control data bits in C are shown in the following diagram. C: 15 14
08 07
Not used. Set to zero.
00 FAL number (2-digit BCD, 00 to 99)
Diagnostics output 0 (OFF): Bit address output (binary) 1 (ON): Bit address and message output (ASCII)
Logic Diagnostic Instructions If the time until the logic diagnostics condition goes ON exceeds T, the logic diagnostic instructions are searched for the OFF input condition. If more than one input condition is OFF, the input condition on the highest instruction line and nearest the left bus bar is selected. 00000
00002
00001
00003
Diagnostic output
323
Page 342
Section 5-26
Special Instructions
When IR 00000 to IR 00003 are ON, the normally closed condition IR 00002 would be found as the cause of the diagnostic output not turning ON. Diagnostics Output
There are two ways to output the bit address of the OFF condition detected in the logic diagnostics condition. 1, 2, 3...
1. Bit address output (used when bit 15 of C is OFF). Bit 15 of D indicates whether or not bit address information is stored in D+1. If there is, bit 14 of D indicates whether the input condition is normally open or closed. D: 15 14 13
00
Not used. Input condition 0 (OFF): Normally open 1 (ON): Normally closed Bit address information 0 (OFF): Not recorded in D+1. 1 (ON): Recorded in D+1.
D+1 contains the bit address code of the input condition, as shown below. The word addresses, bit numbers, and TC numbers are in binary. Data Area
15
14
13
12
11
IR, SR
1
0
0
0
Word address
Bit number
HR
1
0
0
1
1
Word address
Bit number
LR
1
0
0
1
0
0
Word address
Bit number
TC*
1
0
0
1
0
1
*
D+1 bit status 10
09
08
07
06
05
04
03
02
01
00
Timer or counter number
Note a) *For the TC area, bit 09 of D+1 indicates whether the number is a timer or counter. A 0 indicates a timer, and a 1 indicates a counter. b) The status of the leftmost bit of the bit number (bit 03) is reversed. Example: If D + 1 contains 1000 0110 0100 1000, IR 10000 would be indicated as follows: 1000 0110 0100 1000 IR
$64 = 100
Bit 00 (inverting status of bit 03)
2. Bit address and message output (selected when bit 15 of C is ON). Bit 15 of D indicates whether or not there is bit address information stored in D+1 to D+3. If there is, bit 14 of D indicates whether the input condition is normally open or closed. Refer to the following table. Words D+5 to D+8 contain information in ASCII that are displayed on a Peripheral Device along with the bit address when FPD(––) is executed. Words D+5 to D+8 contain the message preset by the user as shown in the following table. Word
Bits 15 to 08
Bits 07 to 00
D+1
20 = space
First ASCII character
D+2
Second ASCII character
Third ASCII character
D+3
Fourth ASCII character
Fifth ASCII character
D+4
2D = “–”
“0”=normally open, “1”=normally closed
D+5
First ASCII character
Second ASCII character
D+6
Third ASCII character
Fourth ASCII character
D+7
Fifth ASCII character
Sixth ASCII character
D+8
Seventh ASCII character
Eighth ASCII character
Note If 8 characters are not needed in the message, input “0D” after the last character.
324
Page 343
Section 5-26
Special Instructions
Determining Monitoring Time The procedure below can be used to automatically set the monitoring time, T, under actual operating conditions when specifying a word operand for T. This operation cannot be used if a constant is set for T. 1, 2, 3...
1. Switch the CQM1 to MONITOR Mode operation. 2. Connect a Peripheral Device, such as a Programming Console. 3. Use the Peripheral Device to turn ON control bit AR 2508. 4. Execute the program with AR 2508 turned ON. If the monitoring time currently in T is exceeded, 1.5 times the actual monitoring time will be stored in T. FAL(06) errors will not occur while AR 2508 is ON. 5. Turn OFF AR 2508 when an acceptable value has been stored in T.
Example
In the following example, the FPD(––) is set to display the bit address and message (“ABC”) when a monitoring time of 123.4 s is exceeded.
SR 25315 MOV(21)
Address
Instruction
00000 00001
LD MOV(21)
Operands
#4142 HR 15 SR 25315 MOV(21) #430D
00002 00003
HR 16
FPD(––)
00004 00005
#1234
LD FPD(––)
HR 10 SR 25504 (CY Flag) INC(38) DM 0100 10000
00006 00007
AND INC(38)
00008 00009 00010 00011 00012 00013
LD OR LD NOT OR NOT AND LD OUT
10002 LR 0015
10001
10003
# HR
4142 15 25315
# HR LR
430D 16 0000
# # HR
0010 1234 10 25504
DM
0100 10000 10001 10002 10003
LR
0015
LD MOV(21)
LR 0000 #8010
25315
FPD(––) is executed and begins monitoring when LR 0000 goes ON. If LR 0015 does not turn ON within 123.4 s and IR 10000 through IR 10003 are all ON, IR 10002 will be selected as the cause of the error, an FAL(06) error will be generated with an FAL number of 10, and the bit address and preset message (“10002–1ABC”) will be displayed on the Peripheral Device. HR 10 HR 11 HR 12 HR 13 HR 14 HR 15 HR 16 HR 17 HR 18
0000 0000 0000 0000 0000 4142 430D 0000 0000
HR 10 HR 11 HR 12 HR 13 HR 14 HR 15 HR 16 HR 17 HR 18
C000 2031 3030 3032 2D31 4142 430D 0000 0000
Indicates information, normally closed condition “1” “00” “02” “–1” “AB” “C”, and CR code The last two words are ignored. (Displayed as spaces.)
325
Page 344
Section 5-26
Special Instructions Flags
ER:
T is not BCD. C is not a constant or is not BCD 00 to 99. Indirectly addressed DM word is non-existent. (Content of DM word is not BCD, or the DM area boundary has been exceeded.)
CY:
ON when the time between the execution of FPD(––) and the execution of a diagnostic output exceeds T.
5-26-8 INTERRUPT CONTROL – INT(89) Operand Data Areas CC: Control code
Ladder Symbols
# (000 to 003, 100, or 200) INT(89)
@INT(89)
CC
CC
000
000
D
D
000: No function # (000) D: Control data IR, SR, AR, DM, HR, TC, LR, TR, #
Note This instruction is not supported by SRM1 PCs. Limitations
DM 6644 to DM 6655 cannot be used for D when CC=002.
Description
When the execution condition is OFF, INT(89) is not executed. When the execution condition is ON, INT(89) is used to control interrupts and performs one of the six functions shown in the following table depending on the value of CC. Note Refer to 1-5 CQM1 Interrupt Functions and 1-6 CPM1/CPM1A Interrupt Functions for more details. INT(89) function
CC
Mask/unmask input interrupts
000
Clear input interrupts
001
Read current mask status
002
Renew counter SV
003
Mask all interrupts
100
Unmask all interrupts
200
These six functions are described in more detail below. Refer to page 22 for more information on these functions. Mask/Unmask I/O Interrupts (CC=000)
326
This function is used to mask and unmask I/O interrupt inputs 00000 to 00003 (00003 to 00006 in CPM1/CPM1A PCs). Masked inputs are recorded, but ignored. When an input is masked, the interrupt program for it will be run as soon as the bit is unmasked (unless it is cleared beforehand by executing INT(89) with CC=001).
Page 345
Section 5-26
Special Instructions
Set the corresponding bit in D to 0 or 1 to unmask or mask an I/O interrupt input. Bits 00 to 03 correspond to 00000 to 00003 (00003 to 00006 in CPM1/CPM1A PCs). Bits 04 to 15 should be set to 0. CQM1 PCs Word D bits:
3 2 1 0 Interrupt input 00000 (0: unmask, 1: mask) Interrupt input 00001 (0: unmask, 1: mask) Interrupt input 00002 (0: unmask, 1: mask) Interrupt input 00003 (0: unmask, 1: mask)
CPM1/CPM1A PCs Word D bits:
3 2 1 0 Interrupt input 00003 (0: unmask, 1: mask) Interrupt input 00004 (0: unmask, 1: mask) Interrupt input 00005 (0: unmask, 1: mask) Interrupt input 00006 (0: unmask, 1: mask)
Clear I/O Interrupts (CC=001)
This function is used to clear I/O interrupt inputs 00000 to 00003 (00003 to 00006 in CPM1/CPM1A PCs). Since interrupt inputs are recorded, masked interrupts will be serviced after the mask is removed unless they are cleared first. Set the corresponding bit in D to 1 to clear an I/O interrupt input. Bits 00 to 03 correspond to 00000 to 00003 (00003 to 00006 in CPM1/CPM1A PCs). Bits 04 to 15 should be set to 0. CQM1 PCs Word D bits:
3 2 1 0 Interrupt input 00000 (0: Do not clear, 1: clear) Interrupt input 00001 (0: Do not clear, 1: clear) Interrupt input 00002 (0: Do not clear, 1: clear) Interrupt input 00003 (0: Do not clear, 1: clear)
CPM1/CPM1A PCs Word D bits:
3 2 1 0 Interrupt input 00003 (0: Do not clear, 1: clear) Interrupt input 00004 (0: Do not clear, 1: clear) Interrupt input 00005 (0: Do not clear, 1: clear) Interrupt input 00006 (0: Do not clear, 1: clear)
Read Current Mask Status (CC=002)
This function is used to write the current mask status for I/O interrupt inputs 00000 to 00003 (00003 to 00006 in CPM1/CPM1A PCs) to word D. The corresponding bit will be ON if the input is masked. (Bits 00 to 03 correspond to 00000 to 00003 in CQM1 PCs, 00003 to 00006 in CPM1/CPM1A PCs.) CQM1 PCs Word D bits:
3 2 1 0 Interrupt input 00000 (0: not masked, 1: masked) Interrupt input 00001 (0: not masked, 1: masked) Interrupt input 00002 (0: not masked, 1: masked) Interrupt input 00003 (0: not masked, 1: masked)
CPM1/CPM1A PCs Word D bits:
3 2 1 0 Interrupt input 00003 (0: not masked, 1: masked) Interrupt input 00004 (0: not masked, 1: masked) Interrupt input 00005 (0: not masked, 1: masked) Interrupt input 00006 (0: not masked, 1: masked)
Renew Counter SV (CC=003)
This function is used to renew the counter SV for I/O interrupt inputs 00000 to 00003 (00003 to 00006 in CPM1/CPM1A PCs) to word D. Set the corresponding
327
Page 346
Section 5-26
Special Instructions bit in D to 1 in order to renew the input’s counter SV. (Bits 00 to 03 correspond to 00000 to 00003 in CQM1 PCs, 00003 to 00006 in CPM1/CPM1A PCs.) CQM1 PCs Word D bits:
3 2 1 0 Interrupt input 00000 counter SV (0: Change, 1: Don’t change) Interrupt input 00001 counter SV (0: Change, 1: Don’t change) Interrupt input 00002 counter SV (0: Change, 1: Don’t change) Interrupt input 00003 counter SV (0: Change, 1: Don’t change)
CPM1/CPM1A PCs Word D bits:
3 2 1 0 Interrupt input 00003 counter SV (0: Change, 1: Don’t change) Interrupt input 00004 counter SV (0: Change, 1: Don’t change) Interrupt input 00005 counter SV (0: Change, 1: Don’t change) Interrupt input 00006 counter SV (0: Change, 1: Don’t change)
Mask/Unmasking All Interrupts (CC=100/200)
This function is used to mask or unmask all interrupt processing. Masked inputs are recorded, but ignored. Refer to page 44 for details. The control data, D, is not used for this function. Set D to #0000.
Flags
ER:
A counter’s SV is incorrect. (CC=003 only) Indirectly addressed DM word is non-existent. (Content of DM word is not BCD, or the DM area boundary has been exceeded.) CC=100 or 200 while an interrupt program was being executed. CC=100 when all inputs were already masked. CC=200 when all inputs were already unmasked. CC and/or D are not within specified values.
5-26-9 SET PULSES – PULS(65) Ladder Symbols
Operand Data Areas P: Port specifier
PULS(65)
@PULS(65)
P
P
C
C
N
N
000, 001, or 002 C: Control data 000 to 005 N: Number of pulses IR, SR, AR, DM, HR, LR
Limitations
This instruction is available in the CPM1A with transistor outputs and CQM1 only. N and N+1 must be in the same data area. DM 6143 to DM 6655 cannot be used for N.
Description
PULS(65) is used to set parameters for pulse outputs that are started later in the program using SPED(64) or ACC(––). The parameters that can be set are the number of pulses that will be output in independent mode, the direction of pulse outputs from ports 1 and 2, and the deceleration point for pulse outputs controlled by ACC(––) mode 0. Since PULS(65) has a relatively long execution time, the cycle time can be reduced by executing the differentiated version (@PULS(65)) of this instruction only when it is needed.
328
Page 347
Section 5-26
Special Instructions Note Refer to 1-3 Pulse Output Functions for more details. Port Specifier (P)
The port specifier indicates the pulse output location. The parameters set by the in C and N will apply to the next SPED(64) or ACC(––) instruction in which the same port output location is specified. P
Control Data (C)
Pulse output location
000
Output bit
001
Port 1
002
Port 2
The control data determines the direction of the pulse output to ports 1 and 2 and indicates whether the number of pulses and/or the deceleration point are specified in N to N+3. This operand should be set to 000 when P=000. C
Direction
Number of pulses
Deceleration point
000
CW
Set in N and N+1
Not set.
001
CCW
Set in N and N+1
Not set.
002
CW
Set in N and N+1
Set in N+2 and N+3
003
CCW
Set in N and N+1
Set in N+2 and N+3
004
CW
Not set.
Not set.
005
CCW
Not set.
Not set.
The direction setting is valid until program execution is stopped or PULS(65) is executed again. Number of Pulses and Deceleration Point
When C=000 to 003, N+1, N contains the 8-digit number of pulses setting for independent mode pulse outputs. N+1, N can be from 00000001 to 16777215. The pulse output started by SPED(64) or ACC(––) will stop automatically when this number of pulses has been output. Leftmost 4 digits Number of pulses:
N+1
Rightmost 4 digits N
Possible range 0000 0001 to 1677 7215
When C=002 or 003, N+3, N+2 contains the 8-digit number of pulses setting for the deceleration point used in ACC(––) mode 0. N+3, N+2 can be from 00000001 to 16777215. The pulse output started by ACC(––) will begin deceleration when this number of pulses have been output. Leftmost 4 digits Deceleration point:
N+3
Rightmost 4 digits N+2
Possible range 0000 0001 to 1677 7215
When C=004 or 005, neither the number of pulses nor the deceleration point are set. Set N=000 when C=004 or 005. Frequency Changes
The number of pulses set to be output will be used even if SPED(64) is used to change the pulse frequency during operation. For example, if the number of pulses setting is 2,100 and the frequency is changed from 1 KHz to 100 Hz, pulse output will stop in: 12 s if the pulse frequency is changed after 1 s at 1 KHz. 3 s if the pulse frequency is changed after 2 s at 1 KHz.
Flags
ER:
There is an error in the instruction settings. If a data area boundary is exceeded. Indirectly addressed DM word is non-existent. (Content of *DM word is not BCD, or the DM area boundary has been exceeded.) PULS(65) is executed in an interrupt subroutine while a pulse I/O or high-speed counter instruction is being executed in the main program.
329
Page 348
Section 5-26
Special Instructions
5-26-10 SPEED OUTPUT– SPED(64) Operand Data Areas
Ladder Symbols
P: Port specifier SPED(64)
@SPED(64)
P
P
M
M
F
F
001, 002, or 010 to 150 M: Output mode 000 or 001 F: Pulse frequency IR, SR, AR, DM, HR, LR, #
Limitations
This instruction is available in the CPM1A with transistor outputs and CQM1 only. F must be BCD, #0000 to #5000 when a port is specified, #0000 or #0002 to #0100 when an output bit is specified. DM 6144 to DM 6655 cannot be used for F.
Description
SPED(64) is used to set, change, or stop pulse output from the specified port or output bit. When the execution condition is OFF, SPED(64) is not executed. When the execution condition is ON, SPED(64) sets the pulse frequency F for the port or output bit specified by P. M determines the output mode. Since SPED(64) has a relatively long execution time, the cycle time can be reduced by executing the differentiated version (@SPED(64)) of this instruction only when it is needed. Note Refer to 1-3 Pulse Output Functions for more details.
Port Specifier (P)
The port specifier specifies the port or output bit where the pulses will be output. P
Output Mode (M)
Pulse output location
001
Port 1
002
Port 2
000 to 150
Output bits IR 10000 to IR 10015. The first two digits of P specify which bit of IR 100 is the output bit and the third digit of P is always set to 0. For example, P=000 specifies IR 10000, P=010 specifies IR 10001, ... and P=150 specifies bit IR 10015.
The value of M determines the output mode. A value of 000 indicates independent mode and a value of 001 indicates continuous mode. In independent mode, the pulse output will continue until one of the following occurs: 1, 2, 3...
1. The number of pulses specified by the PULS(65) instruction is reached. (Execute PULS(65) before SPED(64) when specifying independent mode.) 2. The INI(61) instruction is executed with C=003. 3. SPED(64) is executed again with the output frequency, F, set to 000. When outputting pulses in independent mode, specify the number of pulses beforehand by executing PULS(65). When outputting from port 1 or 2, specify the direction (CW or CCW) as well. In independent mode, the number of pulses that have been output to ports 1 and 2 are contained in IR 236 and 237 (port 1) and IR 238 and IR 239 (port 2). Leftmost 4 digits
330
Rightmost 4 digits
Port 1 pulse output PV:
IR 237
IR 236
Port 2 pulse output PV:
IR 239
IR 238