# Homework and Reading for Birdsong Lab¶

#### ECE 4760, Adams/Land, Fall 2021¶

In order to complete the first lab checkout on time, the following reading and problems should be completed before the start of the first lab section for this lab.

## Questions¶

#### Question 1¶

From the PIC32 datasheet:

1. What is the maximum current you can draw from any i/o pin?
2. What is the maximum current you can source from the sum of all pins.

#### Question 2¶

What MCU hardware is used by ProtoThreads? Can you use timer2 for your own code? How about timer3 and timer5?

#### Question 3¶

We will use a standard audio rate of 44 KHz. The CPU runs at 40 MHz (see the config.h file).

1. Assuming a timer prescalar of 1, after how many timer cycles should your audio synthesis timer overflow and trigger an interrupt?
2. Write three lines of code. You may find it useful to look through examples on the Timers webpage to complete this question.
• The first line of code should open a timer (turns it on, turns on interrupts for the timer, configures it to use the internal clock, sets the prescalar to 1, and sets the toggle rate to the value that you found in the previous question).
• The second line of code should set up the timer interrupt with a priority of 2.
• The third line of code should clear the interrupt flag.

#### Question 4¶

Our audio sample rate is 44 KHz. If you use an int (32 bits) for your DDS accumulator what is the resolution (in Hz) of your synthesizer?

#### Question 5¶

In this lab, it is recommended that you use a linear ramp to modulate your synthesized sounds. A linear ramp is not the only option. What are some other options, and what are their advantages and disadvantages?