Laboratory 8 Software Prep
{"Image DocumentName": "Laboratory 8 Software Prep", "Image ImageDescription": "LOGIC. Initialize: DDRT (Port T 0 is our output to the buzzer) TCNT holds current clock time. TC1 holds our target clock time (when time is reached, flag is tripped) TFLG1_C1F is our flag. TFLG1 = TFLG1_C1F_MASK; resets timer flag. Invert voltage from Port T 0 when timer flag is tripped. Allows control based on real time. We need to use periods for our notes because we are inverting our signal when certain amounts of time have passed. Thus, take the frequencies for the notes in the lab manual and convert to period (frequency = 1/period). Then, we need to invert our signal twice within the period to create the correct note, but the microcontroller simplifies this since the clock is 2 MHz. Since the clock increments every \u00bd microsecond, we can simply define the note as its period in microseconds. Then, the flag trips enough to produce a note with a period of 3817 microseconds (period of a middle C) if you set the target timer to increment by 3817 counts (3817/2 microseconds) and invert when target time is reached (by waiting until the flag is tripped)", "Image XResolution": "37", "Image YResolution": "37", "Image ResolutionUnit": "Pixels/Centimeter", "Image Software": "SlidePlayer", "Image YCbCrPositioning": "Centered"}