diff --git a/examples/SimpleSin/SimpleSin.ino b/examples/SimpleSin/SimpleSin.ino index f6cfd65..06a9ef8 100644 --- a/examples/SimpleSin/SimpleSin.ino +++ b/examples/SimpleSin/SimpleSin.ino @@ -9,6 +9,8 @@ #define PWM_PIN 3 +#define TIMER2_PHASE_ADVANCE 24 + DDS dds; void setup() { @@ -26,17 +28,24 @@ void loop() { dds.setFrequency(2200); } -#ifdef DDS_USE_ONLY_TIMER2 -ISR(TIMER2_OVF_vect) { - dds.clockTick(); -} -#else // Use the ADC timer instead -ISR(ADC_vect) { + +//Uncomment if using dds.startPhaseAccumulator(true); +/*ISR(TIMER2_OVF_vect) { static unsigned char tcnt = 0; - TIFR1 = _BV(ICF1); // Clear the timer flag - if(++tcnt == 4) { + if(++tcnt == TIMER2_PHASE_ADVANCE) { tcnt = 0; + dds.clockTick(); + } +}*/ + +//Comment if using dds.startPhaseAccumulator(true); +ISR(ADC_vect) { + if(false){ + static unsigned char tcnt = 0; + TIFR1 = _BV(ICF1); // Clear the timer flag + if(++tcnt == 4) { + tcnt = 0; + } + dds.clockTick(); } - dds.clockTick(); } -#endif