6F3B0250
7. Instructions
FUN 040 | U/ | Unsigned division |
Expression
Input
Function
T1S only
When the input is ON, the unsigned data of A is divided by the unsigned data of B, and the quotient is stored in C and the remainder in C+1. The data range of A and B is 0 to 65535 (unsigned
Execution condition
Input | Operation | Output | ERF |
OFF | No execution | OFF | - |
ON | Normal execution (B ¹ 0) | ON | - |
| No execution (B = 0) | OFF | Set |
Operand
| Name |
|
| Device |
|
|
|
|
|
| Register |
|
|
|
| Constant | Index | ||
|
| X | Y | R | S | T. | C. | XW | YW | RW | SW | T | C | D | I | J | K |
|
|
A | Dividend |
|
|
|
|
|
| Ö | Ö | Ö | Ö | Ö | Ö | Ö | Ö | Ö | Ö | Ö | Ö |
B | Divisor |
|
|
|
|
|
| Ö | Ö | Ö | Ö | Ö | Ö | Ö | Ö | Ö | Ö | Ö | Ö |
C | Quotient |
|
|
|
|
|
|
| Ö | Ö | Ö | Ö | Ö | Ö | Ö | Ö | Ö |
| Ö |
Example
When R010 is ON, the data of D0030 is divided by the constant data 300, and the quotient is stored in D0050 and the remainder is stored in D0051.
If the data of D0030 is 54321, the quotient 181 is stored in D0050 and the remainder 21 is stored in D0051.
D0030
Constant
54321
300
¸ RW27 RW28
181
21
(quotient)
(remainder)
Note
·If divisor (operand B) is 0, ERF (instruction error flag = S051) is set to ON. The ERF (S051) can be reset to OFF by user program, e.g.
·If the index register K is used as operand C, the remainder is ignored.
·This instruction handles the register data as unsigned integer.
170 T1/T1S User’s Manual
CTi Automation - Phone: 800.894.0412 - Fax: 208.368.0415 - Web: www.ctiautomation.net - Email: info@ctiautomation.net