I am developing a system that needs to drive 4 stepper motors through 4 dual H-bridges, for each phase of movement the AVR will receive SPI messages stating how many steps each motor should do and what delay should be between each step for each motor. The delays will all rounded to multiples of 100 micro seconds so I plan on using the interrupt of a timer set to as close to 100 micro seconds as it can get to count the time passing between the stepping of each motor as to determine when a step function should be executed. The thing is, I also need 4 PWM outputs to "chop" the power supply going to these steppers as to not overtax them.

Now my problem is that I am thinking about using the ATmega8535(L) for this task and it seems to indeed have 4 PWM outputs operating from 3 timers (it seems as if one of them has 2 channels). Now my question is, would I still be able to use the interrupt of one of the timers to drive my stepping functions?

  • \$\begingroup\$ The timers can generate interrupts on many events, such as overflow and/or compare. Whether or not your application is feasible, I can't say. I personally would get a small CPLD or FPGA to handle the logic and a barebones uC for the spi bridge. \$\endgroup\$
    – HL-SDK
    Commented Nov 15, 2013 at 16:16
  • \$\begingroup\$ Are you married to the ATmega8535? the ATmega164 has two 16bit timers with two PWM channels each and another two 8bit timers and the other peripherals you require. datasheet.octopart.com/… \$\endgroup\$
    – Luke Gary
    Commented May 18, 2017 at 3:26

1 Answer 1


You should be fine. If a timer is being used for PWM it should also be useable to generate interrupts. Also, you should be able to use one timer for more than one PWM output. I mean, if they design the chip with 4 PWM outputs and 3 timers, there has to be a way to actually use all 4 PWM outputs.


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.