I'm trying to interface an HEDS 9700 optical encoder using an HCTL-2020 IC (or anything else) with my Atmega ( atmega128, atmega32, atmega16, atmega8 or any AVR-family based microcontroller, don't matter for me ).

But I don't know what should I do. I read datasheets of both devices. What pins from HCTL must connected to my microcontroller (and which one ?) ? Basically, I don't know what to do with this encoder.

Please help me find out the way.



2 Answers 2


If your encoder doesn't pulse too fast I'd do it without the HCTL-2020. There's nothing in it a microcontroller can't do.

The HCTL-2020 is a parallel output device, for interfacing with an 8-bit microprocessor bus (probably from the Crimean War period). Data is on D0-D7 if the OE input is low. Since you have 12/16 bit of data you'll have to use the SEL input to select whether you want the HOB (High Order Byte) or the LOB (Low Order Byte). Use the RST input to reset the counter.

enter image description here

So OE, SEL and RST are outputs from the microcontroller, D0-D7 are inputs.

The HCTL-2016 outputs 2 square wave signals in quadrature, which is needed to tell the rotation direction. These go to the CH A and CH B inputs of the HCTL-2020. If you want to connect the 2016 directly to a microcontroller (saves you 9 I/O pins) you'll want them on pins which can give interrupts on changes.

  • \$\begingroup\$ "Crimean War period" == like! :) \$\endgroup\$ May 14, 2013 at 14:05

Why do you need the HCTL to connect the encoder?

You could connect CHA and CHB each to a digital input pin, Vcc to +5V and Gnd to your circuit ground.
Typically you would use a capture and compare module with a timer to detect and count the pulses from the encoder.

optical encoder


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.