RSGC ACES: ICS4U ATtiny (Series-1) Peripheral Tasks

 


Digital-to-Analog Conversion (DAC). Earlier Arduino boards typically do not offer an accessible DAC. The Arduino Due is one on a number of exceptions (offers a 12-bit DAC!) as does the more recent R4 Minima. The ATtiny414 is one of a number of newer inexpensive MCUs from Microchip with an onboard 8-bit DAC peripheral that is externally accessible (Pin 4).

References

Task.

  1. Create an Arduino Project from the DACSine code provided in the App Note cited above. Review the code (you'll need to have the iotn4i4.h header file at hand for reference) and confirm that you can flash your ATtiny414 with it.
  2. This code will generate a sinusoidal waveform of DC voltages from 0V to 4.34V on pin 4. Place this signal on one lead of a bicolor LED with the other lead at 2.5V from a voltage divider. Adjust the frequency to yield slow, alternating red/green colour ramping on the LED to confirm.
  3. At this point, you are asked to pause and examine how Microchip's code populates the array of sine values. Since this is a one-time generation, it's relatively inefficient dependency on the math library's sin() function may be overlooked, but for for your future projects you are asked to do better. Anytime you can replace floating point arithmetic with comparable integer routines you will have gained performance. Review the Minsky Circle algorithm referenced above and rewrite the sineWaveInit() function using the Minsky approach. David Johnson-Davies provides his implementation in the Tiny Function Generator Sine Wave link above.
  4. TBC...


 

Direct Digital Synthesis (DDS). TBC...

Reference