Omron SYSMAC C20K Operation Manual page 136

K-type programmable controllers
Hide thumbs Also See for SYSMAC C20K:
Table of Contents

Advertisement

BCD Calculations
Description
Flags
Example
0000
Dd : IR 20
0
0
0
5-16-5
SET CARRY – STC(40)
0002
5-16-6
CLEAR CARRY – CLC(41)
0002
When the execution condition is OFF, DIV(33) is not executed and the next
instruction is moved to. When the execution condition is ON, the content of
Dd is divided by the content of Dr and the result is placed in R and R + 1: the
quotient in R and the remainder in R + 1.
Dr word
ER:
Dd or Dr is not in BCD.
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.
When IR 0000 is ON with the following program, the content of IR 20 is di-
vided by the content of HR 9 and the result is placed in DM 17 and DM 18.
Example data and calculations are shown below the program.
Quotient
R : DM 17
1
1
5
0
Dd : IR 20
3
4
5
2
3
Set carry is used to set (turn ON) the CY (SR bit 1904) to "1."
Clear carry is used to reset (turn OFF) the CY (SR bit 1904) to "0."
Quotient
R word
Dd word
Address Instruction
0000
DIV(33)
0001
20
HR 9
DM 17
Remainder
R + 1 : DM 18
0
0
0
2
Address Instruction
STC(40)
0000
0001
Address Instruction
CLC(41)
0000
0001
Section 5-16
Remainder
R + 1 word
Operands
LD
0000
DIV(33)
HR
DM
Operands
LD
0002
STC(40)
Operands
LD
0002
CLC(41)
20
9
17
125

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac c40kSysmac c60kSysmac c28k

Table of Contents