Lab 11 Math Instructions
Lab 11 Math Instructions
Lab 11
Lab 11 Math Instructions
Math Instructions use words not bits
Bit I:0/5
or
Bit I:0.0/5
Word Level: Needs more than one bit. The number 7 from a
thumbwheel switch in binary (BCD) requires the word level.
Lab 11-1
Math Instructions Project
Lab 11-1 Math Instruction Project
PHOTO GOOD
#1 PARTS
STAMPING
PRESS
PHOTO #2
BAD
PARTS
Lab 11-12 Math Instruction Project
Quality Control: If more than 10 % (3 bad parts) are rejected the process
shuts down. Photocell #2 will subtract the bad parts from the total to give good
parts. Use cylinder #1 to be the stamping press, oscillating out and back 25 or
more times depending on the number of bad parts.
CYLINDER
PHOTO GOOD
#1 PARTS
STAMPING
PRESS
PHOTO #2
BAD
PARTS
Lab 11-1 Math Instruction Project
Quality Control: If more than 10 % (3 bad parts) are rejected the process
shuts down. Photocell #2 will subtract the bad parts from the total to give good
parts. Use cylinder #1 to be the stamping press, oscillating out and back 25 or
more times depending on the number of bad parts.
CYLINDER
PHOTO GOOD
#1 PARTS
STAMPING
PRESS
PHOTO #2
BAD
PARTS
Lab 11-1 Math Instruction Project
Lab 11-2
Scale with Parameters Instruction
Scale With Parameters Instruction
The Scale with Parameters instruction is very useful for changing a data word into an
engineering scales such as temperature, RPM, flow rate, pressure, gallons, etc. Data
transmitted from most transducers is often in the form of 4 to 20 ma which is changed by
the analog to digital converter to 4000 to 20,000 and stored in a 16 bit word. That data is
called raw data and does not indicate the numbers corresponding to the units needed. The
SCP instruction can change to the scale needed. The diagram below illustrates the
process.
4-20ma
Temperature
Transducer Analog PLC
Input
Module
Temperature Probe
Scale With Parameters Instruction
Lab 11-3
FRD Conversion Instruction
Converting BCD to Binary
C 1 I:0/4
2 I:0/5
Unit
4
0s-9 I:0/6
8
The BCD (Binary Coded Decimal) code stores numbers from 0-9 in
groups of 4 in the memory. Each numbers is a nibble (4-bits) and
number larger than 9 will use more groups. For example 99 would
use 2 nibbles. A 16 bit word has four nibbles and can store a BCD
code to represent the decimal number 9999
Stardard binary as shown below has the weight double in the next column to the left. If the number 75 was stored as standard binary if would look like this:
0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 1
Converting BCD to Binary
0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 1
StardardThe
binary
sameas number
shown below
in BCD
haswould
the weight
be stored
double
as in the next column to the left. If the number 75 was stored as standard binary if would look like this:
0 0 0 0 0 0 0 0 0 1 1 1 0 1 0 1
0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 1
Converting BCD to Binary 7 5
0 0 0 0 0 0 0 0 0 1 1 1 0 1 0 1
Stardard binary as shown below has the weight double in the next column to the left. If the number 75 was stored as standard binary if would look like this:
0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 1
Converting BCD to Binary
It is necessary to convert BCD to Binary for numbers greater than 9 in BCD. The
FRD instruction will convert BCD to binary.
In the FRD instruction below, the 2-unit thumbwheel switch is wired to slot 0 input
modules terminals 0-7. The number on the thumbwheel switch in BCD will be
converted to standard binary and loaded into the integer file. Hen it will move to
a counter with the MASK MOVE instruction which blocks out switches wired to
the same input word.
I:0.0
N7:0
Stardard binary as shown below has the weight double in the next column to the left. If the number 75 was stored as standard binary if would look like this:
0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 1
PLC Program to convert BCD to Binary
FRD instruction
FRD instruction
Chapter
Programmable Logic Controllers
The End
Lab 11 Math Instructions