Optical Encoder Pulse Counting with a PLC

I have interfaced a QD145 200 Line Count Optical Encoder to a DL06 PLC and set up the PLC for mode 20 ‘High speed Up/Down counter’.

Here is a video of Optical Encoder Counting:

Optical Encoder Counting with PLC

Below is the ladder logic code for programming the PLC to count pulses from the QD145 optical encoder using high speed counting mode.  Note that “high speed” for the DL06 standard inputs is still limited to 7kHz. Where the encoder can go as high as 500 kHz by specification.

Setting up the ladder logic code for the DL06 is fairly straightforward in that the UDC (up down counter) seems to be built to take optical encoder inputs.

When in high speed mode, inputs X0 and X1 are inputs to the counter (CT174) by default.  Input X2 is a reset input and could be wired to the index channel on the optical encoder if we were looking to translate the count into a 360 Position, but is left unwired for this up down count application.

Optical Encoder Ladder Logic for Counting with a PLC

The first rung on the counter (CT174) is the ENABLE. I latched C11 off of the first scan bit (SP0) to enable the counter.  Note that CT174 was not picked arbitrarily, it is the specified counter location for high speed counting

The use of X0 and X1 on the second rung of the counter may seem a bit odd if you thought they were feeding counts the counter; instead those inputs are being used to updated the count from the input buffer to the counter memory location.  To ensure that we always have the most accurate information. I place the two inputs parallel to trigger the update whenever we see a pulse from A OR B.  This rung could also be held on for constant updating.

I am using bit 2501.0 (the F1 Key from the panel) to force a reset on the counter when ever the button is pressed.

Bit 1175.15 is the MSB from counter CT174 and indicates when the count has gone negative.

For more information on Optical Encoders check out the Quantum Devices Inc web page.


About Quantum Devices Inc.
Quantum Devices, Inc. (QDI) Barneveld, WI, was established as a Wisconsin corporation in October 1989, as an outgrowth of activities in the general area of optoelectronics. The main goal of QDI is to provide customers with a complete source for all stages of product design and development, starting from concept to a marketable commodity. These products include application specific Silicon Photodiodes, Optical Encoders and Light Emitting Diodes (LED) for commercial, industrial and medical applications. QDI's photodiodes and LED's are used in instrumentation for photosynthesis and photobiological research, biomedical and medical instrumentation for measuring blood sugar levels (glucometer), oxyhemoglobin and pulse rate (pulse oxymeter). One of the most dramatic products developed at QDI was the application of LED lighting systems for use as the light source for Photodynamic Therapy (PDT). Sales of QDI products include both domestic and international markets. Quality and reliability are very important concepts in maintaining our company wide commitment to overall product performance. Quality simply means continuous process improvement. We are committed to continually increasing our product excellence through increased quality and reliability. Quantum Devices, Inc. is ISO 9001 certified and the ISO Standard will provide the guidance for the vital function of maintaining our commitment to constantly improve our product quality. Quantum Devices is now proud to introduce it's new line of rotary encoders. Incorporating QDI's patented sensor technology, our QPhase™ Family of Encoders feature high resolution, increased frequency response and superior reliability over temperature (0 to 120 degrees C). QDI incremental and absolute encoders set a new standard and are backed by a 2 year factory warranty. We invite you to request an evaluation unit, additional information or price quotations. Mission Statement Quantum Devices is dedicated to the principle that light provides the power for all life on earth. We believe the quality, delivery and control of light is essential to the wellness of man and his advancement into the future.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: