i am very new to electrical engineering and super unsure what to buy, because this is my first practical project...

The task:
I want to implement a hardware timer with ~1MHz frequency for the HCTL-2022 chip. For this i would use the TCL555CP Timer, two resistors with 500 Ohm and 1 kOhm, a capacitor of 1nF and a smoothing capacitor of 10nF as shown in this wikipedia article.

The usage:
The HCTL-2022 is reading a optical incremental encoder with ~4kppm. I want to read the HCTL with the Arduino Mega 2560. I need the timer because i think the microcontroller is not able to create a frequency that high.

Is this setup ok for my task? Is there a better / easier way? Can you give me any tips? Do i have to pay attention which capacitor or resistor i am buying?

Thanks for your time and help!

  • \$\begingroup\$ "i think the microcontroller is not able to create a frequency that high." Why? Are you running it off a watch crystal? \$\endgroup\$ Commented Oct 16, 2015 at 8:44
  • \$\begingroup\$ i am reading data from the HCTL and transfering them over Serial to a desktop application. because of that i thought it is no possible to hold a frequency of 1 MHz while doing timing relevant operations. \$\endgroup\$
    – Jens
    Commented Oct 16, 2015 at 8:48
  • 2
    \$\begingroup\$ But that's what the timer peripherals are for. \$\endgroup\$ Commented Oct 16, 2015 at 8:49
  • 1
    \$\begingroup\$ While you can get 1 MHz from the TCL555P, please read p.9, "Operating Characteristics", fmax for the component values. \$\endgroup\$ Commented Oct 16, 2015 at 16:18

1 Answer 1


First way to complete your task - give clock for decoder from arduino's hardware timer output. There is some low-level code.
Also, you may read app.notes at atmel.com

Other way - using only arduino, without any additional ICs. I don't sure about performance, but this code seems operable. If this code is not fast enougth, you should use bare-metal C language, without arduino libraries.


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.