Your first post said you needed to be able to select 2 frequencies. How are they selected? If they are just hardcoded in and there is nothing in the "main", there is no need for an interrupt. You can do it all from the main routine. This will save all the time required to process the interrupt.your code would have 1 line looking for the timer overflow such as :then load 2 counters, 1 for each outputCode:while !tmr0 overflow wend
then on each overflow, decrement the freq's. when 1 reaches zeroCode:freq1 = period / timer0 freq2 = period2 / timer0
now don't forget to reload the timer unless you can set it up to just free run. You will need to play with the freq's counter numbers to "tune" the output, but I suspect you can get it right on the money.Code:if !freq then toggle output bit reload freq endif




Bookmarks