Download Introduction - Artisan Technology Group

Transcript
Chapter 6
Compute/Math Instructions (CPT, ADD, SUB, MUL, DIV, MOD, SQR, SQRT, NEG, ABS)
The MOD instruction divides Source A by Source B and places the remainder
in the Destination.
Modulo (MOD)
Operands:
Relay Ladder
Operand
Type
Format
Description
Source A
SINT
immediate
value of the dividend
INT
tag
DINT
REAL
A SINT or INT tag converts to a DINT value by sign-extension.
Source B
SINT
immediate
INT
tag
value of the divisor
DINT
REAL
A SINT or INT tag converts to a DINT value by sign-extension.
Destination
SINT
tag
tag to store the result
INT
DINT
REAL
Structured Text
dest := sourceA MOD sourceB;
Use MOD as an operator in an expression. This expression divides sourceA by
sourceB and stores the remainder in dest.
See Appendix C, Structured Text Programming for information on the syntax
of expressions within structured text.
Function Block
266
Operand
Type
Format
Description
MOD tag
FBD_MATH
structure
MOD structure
Publication 1756-RM003K-EN-P - July 2008
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com