Ok,i will look into timer2.Thank you. On Thu, Mar 5, 2009 at 12:45 PM, Olin Lathrop wrote: > kilgarenone wrote: > > I want to produce a frequency(I use PWM) for a certain period of > > time(timer0),then interrupt-on-overflow to stop the frequency for > > another period of time.So i should have tones play at certain > > interval. > > Using the PWM hardware to generate the frequency makes sense, but using > timer 0 to stop a tone seems awkward. Is this tone for humans to hear? If > so, you don't need much accuracy on starting and stopping it. You could > use > timer 2 to set up a periodic interrupt and have it count to stop the tone. > You will probably find other uses for a master clock tick. > > A interrupt every 1mS takes only a tiny fraction of average CPU cycles, and > is much more resolution than you need to start and stop a tone for humans > to > hear. Even 50mS is probably fine for that. > > > ******************************************************************** > Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products > (978) 742-9014. Gold level PIC consultants since 2000. > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist