maybe having that division in the ISR is slowing it down too much?
(but i doubt it)
I based mine on this,
but using (previously) DAC0808s instead of PWM.
currently i am outputting to 4 DACs (via a ROM chip) and i can send 4 8 bit ROM addresses and calculate for 4 frequencies in a 31.25 khz ISR
Here is the current ISR part of my Scarab bass synth.(now it uses 2x AD7528 instead of 4x DAC0808)
SIGNAL(PWM_INTERRUPT) //The timer interrupt.
{
PORTB = PORTB & 11111000; //reset DAC control bits
PORTB = PORTB + 2; //Switch to chip 2 DAC 1
PORTC = WT1TOP; //send wavetable address to ROM
PORTA = DAC2Aout; //send actual wave address byte to ROM
PORTB = PORTB + 1; //Switch to chip 2 DAC 2
//PORTC = WT1TOP; //send address to ROM [redundant actually]
PORTA = DAC2Bout;
PORTB = PORTB + 1; //Switch to chip 1 DAC 1
PORTC = WT0TOP; //send address to ROM
PORTA = DAC1Aout;
PORTB = PORTB + 1; //Switch to chip 1 DAC 1
//PORTC = WT0TOP; //send address to ROM
PORTA = DAC1Bout;
DAC1Aout = (((o1.phase>>16)%LUTsize)^ByteModArray[WT0xor0])- ByteModArray[WT0add];
DAC1Bout = ((o1.phase2>>16)%LUTsize)^ByteModArray[WT0xor1];
DAC2Aout = (((o1.phase3>>16)%LUTsize)^ByteModArray[WT1xor0])- ByteModArray[WT1add];
DAC2Bout = ((o1.phase4>>16)%LUTsize)^ByteModArray[WT1xor1];
ByteModArray[6] = DAC2Aout; //a modulation source
o1.phase += (uint32_t)o1.phase_increment;
o1.phase2 += (uint32_t)o1.phase2_increment;
o1.phase3 += (uint32_t)o1.phase3_increment;
o1.phase4 += (uint32_t)o1.phase4_increment;
if (PORTA <= 1){sync = HIGH;} //pulse once at the start of each cycle for synth sync
if (SYNCCONT > 0){
if (sync == HIGH) {
o1.phase2 = o1.phase;o1.phase4 = o1.phase3; //for sync
sync = LOW;
}