Easily Interfaced to PLCs Using Standard Digital DC Inputs
Or Directly to Gray Code Modules*
Features
■ Absolute 8 Bit Output
■ Rugged Construction
■ 3/4" Shaft with Ball Bearings
■ NEMA 12 or NEMA 4X
Applications
■ Packaging Machines
■ Pick and Place Operations
■ Assembly Machines
■ Food Processing Equipment
■ Indexing Equipment
PS-4256/4257 (NEMA 12)
General Information
Sinking† or Sourcing† Output — The encoders are available with Sinking† or Sourcing† outputs. Be sure to order
the type that is compatible with the control's input circuits. The use of fast response DC inputs is recommended
to minimize missed fast pulsing encoder outputs.
NEMA 4X Option — The NEMA 4X version of the encoder includes a stainless steel enclosure and shaft,
double sealed ball bearings, and conformal coating on
both sides of the internal circuit board. This version should
be ordered for applications which involve washdowns,
high humidity or corrosive atmospheres.
*
A-B 1771-DL or Similar type modules
13647 Metric Rd • Roscoe, IL 61073 USA • 815-389-2620 • FAX 815-389-3304 • 800-228-5487 (USA & Canada)
†
See page 7 for sinking/sourcing definitions
Page 2
Why 8 Bit Gray Code?
When wiring an encoder to the PLC, the most important thing to
remember is which output is the MSB (Most Significant Bit) and
which is the LSB (Least Significant Bit). If the order is reversed,
or the output wiring is out of order (transposed wires), the value
that you create in the PLC register will not sequence properly.
MSB and LSB are digits of the binary number. An understanding of the different number systems used by logic controllers
(binary, hex, decimal, etc.) is essential to know what these codes
signify.
■ Gray Code is a cyclic or reflected binary code, specifi-
cally designed for positioning information. In a Gray Code
number only one-digit changes at a time. In a binary number, going from one number to the next may have manyof its digits change.
The cyclic change is created by the relationship of the 8
pulse disks that turn the encoder OFF and ON. (See
Figure 6, page 6.)
■ Most Significant Bit refers to the binary code (Gray
Code) digit that is on the far left when written out. This
digit changes the least as the binary number goes from
0 to 255.
■ Least Significant Bit refers to the binary code (Gray
Code) digit that is on the far right when written out. This
digit changes the most as the binary number goes from
0 to 255.
Absolute Position Decoding — The 8 Bit Gray Code
signal always represents the current position of the encoder shaft. The PLC cannot get out of sync with the
present encoder position — not even when the encoder
shaft is turned while power is off to the controller.
8 Bit Resolution (256 increments) — The revolution of
the encoder shaft is divided into 256 uniform increments.
Each increment is 1.4 degrees wide, which allows any
machine position to be known within ±0.7 degrees. This
is appropriate resolution for many applications, especially
when PLC scan times are taken into account (@ 60 RPM,
a 10 mSec scan time equates to 3.6 degrees of motion
between scans).
Error Free Decoding — Only one of the bits changes
state when the encoder shaft rotates, eliminating the need
for sophisticated latching and/or handshaking circuitry between the encoder and the PLC. Standard DC input cards
are used to interface with the encoder. The only special
programming needed is 8 exclusive-ORed (XOR) ladder
rungs.
RPM / Response Considerations
The operating speed and resolution required of the application
must be considered when interfacing the Gray Code encoder
directly to a PLC or other control device. The scan speed and/or
hardware response will cause delays that can reduce the overall
system response and resolution. Where full 8 bit resolution is
required at higher speeds, the use of an Electro Cam PL
µS
(Programmable Limit Switch) is recommended.
Values might not be true for certain fast response PLC inputs.
Faster response times are dependent on hardware.
The table above indicates the maximum RPM that the encoder can be turning for all 256 positions to be decoded each revolution for the corresponding scan time.
Exceeding the indicated RPM will result in encoder shaft positions being skipped by the control. It is acceptable to skip encoder positions when 8 bit resolution is not
required. Worst case output response = 2 Scans + Hardware response.
Refer to the above chart to compare machine RPM to the values
listed on the chart. If speed exceeds the value, the PLC will not
"see" certain Gray Code values. Miscalculation of the output value
will occur.
If a bit is on for 30 µSec, and the scan time is 10 mSec, the
Deg / ScanDeg / ScanDeg / ScanDeg / Scan
Figure 1
When machine speed rises above a certain level, several factors need to be considered:
■ What is the scan time of the PLC program?
■ What is the response time of the input module?
■ What is the integer value that is being used, and is it de-
pendent on several of the least significant bits?
processor will not see that bit (or combination of bits). If the input
module's response time is longer than the bit, or bits on time, the
module will not react to the input. All of these factors show up as
non-sequencing position values, or outputs that are not performing properly.
2
Page 3
Decoding Gray Code?
The Ladder Programming examples shown below apply
for all Gray Code Encoder models. The examples show
how to convert the 8 Bit Gray Code output signal (G0-G7)
of the encoder to a binary number (B0-B7) during each
scan of the PLC. The value of the Binary result will always be in the range of 0 - 255 because the 8 bit encoder
divides each revolution into 256 uniform increments. Ladder rungs which follow the conversion can compare the
rotary position value to known positions for control of
machine devices that must operate at specific positions
within the overall machine cycle. The rotary position of
Models DDN & DDP
CLOCKWISE ROTATION
G7
B7G6
G6B7
B6G5
G5B6
B5G4
G4B5
B4G3
G3B4
B3G2
G2B3
B2G1
G1B2
B1G0
G0B1
DRAWING L-1
B7
B6
B5
B4
B3
B2
B1
B0
COUNTER-CLOCKWISE ROTATION
G7
B7G6
G6B7
B6G5
G5B6
B5G4
G4B5
B4G3
G3B4
B3G2
G2B3
B2G1
G1B2
B1G0
G0B1
DRAWING L-2
B7
B6
B5
B4
B3
B2
B1
B0
the machine cycle can also be used to gate input sensors
and shift register functions.
Converting Gray Code to Binary involves a sequence of
"Exclusive OR" operations. It is simple to program this
same conversion logic in other programming languages
besides ladder logic. In addition to decoding the rotary
position of the encoder, controls with arithmetic capability
can be programmed to perform direction reversal, position offset and re-zero functions, as well as convert the
position value to degrees for ease of monitoring and setup.
Model DDH
COUNTER-CLOCKWISE ROTATION
G7
B7G6
G6B7
B6G5
G5B6
B5G4
G4B5
B4G3
G3B4
B3G2
G2B3
B2G1
G1B2
B1G0
G0B1
DRAWING L-3
B7
B6
B5
B4
B3
B2
B1
B0
CLOCKWISE ROTATION
G7
B7G6
G6B7
B6G5
G5B6
B5G4
G4B5
B4G3
G3B4
B3G2
G2B3
B2G1
G1B2
B1G0
G0B1
DRAWING L-4
B7
B6
B5
B4
B3
B2
B1
B0
Use a limit test function to program a pulse in the PLC. The limit test uses a test reference (in this case the integer
register that the Gray Code is going into), and compares it to see if it is between a lower limit and an upper limit. If the
integer value is between the lower limit (ON setpoint), and the upper limit (OFF setpoint), the rung is true and an output
is turned on. If the integer value does not fall between the upper and lower limits, the rung is false, and nothing happens.
For every output pulse to occur, a different limit test must be programmed with the appropriate limits. Reminder: The
limit values are position values, not degrees.
PLC
Output
LIM
Limit Test
Low Lim107
107<
TestN7:0
0<
High Lim128
128<
3
O:2.0
( )
0
Page 4
Gray Code — Error Free Decoding
The Gray Code chart below
(Figure 2)
shows the bit patterns that are used to represent all 256 encoder positions.
It can be seen on this chart that from any position to any
adjacent position, only 1 bit changes state. This ensures
that the encoder inputs can be read by the control at any
point in time (even during a transition) without error.
Consider the following comparison to Binary Code:
INCDEGGRAY CODEBINARY
127178.60100000001111111
128180.01100000010000000
When Gray Code advances from increment 127 to 128,
only 1 of the 8 bits changes state — bit 8. When Binary
Code advances from increment 127 to 128, all 8 bits
change states. Sampling the Binary bits during this transition could result in a very large decoding error. Sampling
the Gray Code bits during this transition would yield either
127 or 128, depending only on bit 8.
Refer to the table below to understand the relationship
between the
numbers
increment
(integer),
degrees
and
binary
. Use this table as a guide for setup and trouble-
shooting your Gray Code system.
■ INC (increment) column represents the integer value
to which the Gray Code is equal. The increments
are 0 to 255 (256 total) that repeat or cycle. (At 255,
the next number change is 0, increment to 255, then
repeat the cycle over again).
■ DEG (degree) column represents the actual degree
position that the Gray Code is indicating.
■ Gray Code column shows the Gray Code value
for that particular position. This Gray Code binary
number is the same as the Gray Code inputs status,
1 = ON and 0 = OFF.
Because the Gray Code value is also a graphic representation of the input status, it is an invaluable tool in
checking the position or troubleshooting.
Ambient Temp.0 - 60 Degrees C0 - 60 Degrees C
EnclosureJIC - 16 Ga SteelJIC - 16 GA Stainless
Shaft Dia. / Material3/4" Stainless Steel3/4" Stainless Steel
Bearings3/4" Sealed Ball Bearing3/4" Double Sealed Ball
Conformal CoatingComponent Side of PCBBoth Sides of PCB
ElectricalSourcing
Input Voltage12 - 30 VDC12 - 30 VDC
Output Voltage12 - 30 VDC3 - 30 VDC
Output Current (each bit)50 mA50 mA
Output Logic TypeHigh TrueLow True or High True
†
See page 7 for sinking/sourcing definitions
The 8 Bit Gray Code Encoder Output Chart (
Figure 6
†
Sinking
) shows the transitions of each of the 8 bits as the encoder rotates
†
from 0 to 360 degrees. The output bits are phased so that only one bit changes state at each of the 256 increments.
The pulse disc which operates bit 0 (least significant) has 64 uniformly spaced slots, bit 1 has 32 uniformly spaced
slots, bit 2 has 16 uniformly spaced slots, and so on. The 8 bit output of the encoder is always one of the 256 bit
patterns shown in the table on page 4
(Figure 2)
and always represents the current position of the encoder shaft. For
this reason, the control cannot get out of sync with the encoder. High speed count cards that use incremental encoders are NOT absolute and require marker pulses, or other reference signals, for position synchronization.
PS - 4300 - 03 - XXX (XXX = Length in Feet): 10 Conductor #22 gauge shielded (foil and braid) cable for use with encoders. Cut to
specified length, stripped, tinned, connectors attached to shield.
EC - 8001 - XXX - XXX (X's for pitch and # of teeth): Sprocket disengagement clutch allows encoder to be rotated without turning the
chain which drives the encoder. Call for more information.
†
SINKING or SOURCING (as pertaining to Electro Cam Corp. products)
Sinking
means that when the logic is true and the output (or input device) is ON, the output (or input device) is providing a DC
common or ground to the connected device.
Sourcing
means that when the logic is true and the output (or input device) is ON, the output (or input device) is providing a +DC
voltage to the connected device.
This information is important when interfacing an Electro Cam Corp. product with another electronic device. If you are using an
Electro Cam Corp. product input to an Allen-Br adley 1746-IN16 “sinking” input card* or similar A-B de vice, y ou hav e to supply a +DC
voltage (Electro Cam Corp.
Sourcing
output) to this card, NOT a DC common or ground. In these cases,
Sinking
is what the card
does with the input voltage; sinks it to common or ground.
* Other manufacturers include, b ut not limited to: Koyo (formerly GE Series 1, Texas Instruments, or Siemens SIMATIC PLS’s) that use descriptions
similar to Allen-Bradley.
7
Page 8
Electro Cam Corp. is highly experienced in supplying
automation solutions to a variety of industrial machinery.
For assistance with your application, please call us.