| ??? 12/15/03 21:30 Read: times |
#60677 - RE: 2 timers Responding to: ???'s previous message |
There is no difference if you use C language or assembly language, you have to use the timers on the chip which need same initialization and interrupts with either language.
I designed 4 tone ambulance siren recently and used 2 timers, one timer interrupt generates the tone, the other timer interrupt changes the reload value of the first timer according to a sine lookup table generated by excell and pasted into the compiler, to modulate the frequency of the tone. Wail : 600 - 1600 Hz 12 cycles per minute Yelp : 600 - 1600 Hz 180 cycles per minute Piercer 600 - 1600Hz 800 cycles per minute Horn : 1600Hz fixed . I made four functions Wail, Yelp, Piercer and horn, when you call one function it initializes the timer 1 interrupt according to the frequencies shown above. It was fun, especially for I used my evaluation board for the first time. No hardware to build and worry about, just start experimenting with the software. The only problem i had is I hurted my ears experimenting with audio amplifiers and horn speakers. Mahmood |



