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 :
Code:
while !tmr0 overflow
wend
then load 2 counters, 1 for each output
Code:
freq1 = period / timer0
freq2 = period2 / timer0
then on each overflow, decrement the freq's. when 1 reaches zero
Code:
if !freq then
toggle output bit
reload freq
endif
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.
Bookmarks