Fixed using signed numbers for counting in the ISR, and added sine/sawtooth support to the ISR.