Chapter 11 Flashcards
math instructions
use the contents of 2 words or registers and perform the desired function
CPT
compute
- evaluates an expression & stores result in destination
- used to make own formulas
ADD
adds source A to source B and stores result in destination
SUB
subtracts source B from source A and stores result in destination
MUL
multiplies source A by source B
DIV
divides source A by source B
SQR
calculates square root of source & puts in destination
NEG
negate
changes sign of source
TOD
to BCD (binary coded decimal) converts 16 bit integer source to BCD & stores in destination
FRD
from BCD
converts BCD value and stores in destination
arithmetic status bits
- carry (C) = address S2:0/0, set to 1 when there is carry in ADD & borrow in SUB
- overflow (O) = address S2:0/1, set to 1 when result is too large to fit in dest.
- zero (Z) = address S2:0/2, set to 1 when result of subtract instruction is zero
- sign (S) = address S2:0/3, set to 1 when result is negative
MOD
modulo instruction
-used to calculate remainder after value stored in source A is divided by value stored in source B
ONS
one shot in a scan, similar to OSR
good feedback loop
error is small, feedback catches up quickly
controller tag vs local tag
- local tag: real inputs wired to PLC
- controller tag: just used for logic, for things not actually present
analog output O:6.0
can put 0 to 32767 in here to drive the motor
latching/unlatching coils
must have same addresses, latching holds power when power is turned off