timer problem

1 post / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


I am fairly new with using timers, and I am wondering in general way how I should approach my timer problem.

Input: a 120Hz pulse that varies no more than 1uS from leading edge to leading edge.

Process and store: variables received in real time from UART to control output no big timing worries on the UART variables getting updated.

Output: Three wave forms, programmable through variables received from UART.

1. First wave form needs to be programmable through the UART to pulse ever N input pulses, and to be disabled (typically for 42mS.) for a programmable time afterwards, for a programmable number of milliseconds. The time high is also programmable, and will typically range from 1600uS to 2000uS. The delay after the rising edge on the input will range from 0 to 8300uS. A delay longer than that just means to skip a pulse plus some offset.

If the second waveform is enabled, then this waveform needs to not pulse when the second waveform goes high and again not when the second waveform goes low.

2. Second wave is typically not used, but when it is, it goes on for the entire duration of N triggers. If not used, it just stays low. It also stays low during the same disable period. It needs to start and stop within 0 to 8300uS of the input signal. It will always be on at least two pulses and as many as 100. Though typically around five or six. During this time, pulse 1 is probably going on and off ever N.

3. Third wave form always triggers exactly when the first wave form triggers, however, it continues to trigger during the disabled period. Its accuracy during this period is not crucial.

So, I am not asking anyone to do this for me as I do enjoy Atmel's and look forward to the experience. However, I am new with timers, and I would like to be pointed in the right direction on how to set it up.

All waveforms need to be as accurate as possible, hopefully to within 10 or 20uS, and absolute worst case of 40uS for the values stated in uS and within half a millisecond for those values stated in mS.

Thank you for any help that you might give,