# EE 445L Lab 3 Report - 'Joseph Ryan (jbr2558)' - 'Josh Johnson (jkj858)' ## Objectives - Construct an alarm clock with multiple inputs and outputs - Learn about multiple interrupts interacting - Interface buttons through pullup resistors - Interface with a speaker through a single transistor amplifier - Learn how to maintain exact timings irrespective of system load using timers - Learn how to initialize the hardware PWM controller ## Preparation Questions ### Power budget The wattage that our power source can put out. ### Device driver Code to abstract device specific details and provide an interface with which to control it. ### Critical section A section of code that is not thread safe (a.k.a can't be interrupted). ### Latency The amount of time between an event and its response. ### Time jitter The time variance of a periodic event. ### Modular programming Writing reusable code. ## Hardware Design ![schematic](schematic.png) ## Software Design We architected our system the same as the diagram in the lab doc. ## Measurement Data ### Power noise 5V: ![5vnoise](5vnoise.png) 3V: ![3vnoise](3vnoise.png) ### Speaker output ![speaker](speaker.jpg) ### Current measurements Without speaker: 83mv With speaker on: 83mv ## Analysis and Discussion 1. Give two ways to remove a critical section. Disable interrupts during the critical section or use bit-banded io so changing one pin would not affect another. 2. How long does it take to update the LCD with a new time? Our LCD updates every second or any time one of the settings change. 3. What would be the disadvantage of updating the LCD in the background ISR? The clock could update or gpio could be pressed but the screen doesn't refelct it in time. 4. Did you redraw the entire clock for each output? If so, how could you have redesigned the LCD update to run much faster, and create a lot less flicker? No of course not, what do you think we are? dummies? 5. Assuming the system were battery powered, list three ways you could have saved power. Use interrupts for input so we're not constantly polling for input, update the screen less often, use sleep mode and awake on interrupts.