2008-09-30 08:36 PM
Outputting a fixed number of pulses.
2011-05-17 03:46 AM
you could use PWM with the period interrupt prescaler.
2011-05-17 03:46 AM
Hi all,
I wish to output a fixed number of square wave pulses (e.g. 100) at a fixed frequency (e.g. 1 MHz). Using the example values, this effectively would mean toggling a port pin every 500ns! How would I go about this, without toggling port pins directly? I assume this is too fast to use interrupts (especially as I have other time critical routines running). I have available on my circuit: TIM1 and its output port pins & DMA channels. Any advice would be gratefully received. Cheers. :o2011-05-17 03:46 AM
PWM seems like a good idea.
If you use TIM1 you can use the REP register to get an interrupt after the 100 pulses (to shut the PWM down). /Niklas