Question: prelab 1-2 ( c language for microcontroller) PRELAB 1. Write a program to generate a four-tone siren using the speaker on D12PU board with each

prelab 1-2 ( c language for microcontroller) prelab 1-2 ( c language for microcontroller) PRELAB 1. Write a program
to generate a four-tone siren using the speaker on D12PU board with
each tone lasting for one second. The frequencies of these four tones

PRELAB 1. Write a program to generate a four-tone siren using the speaker on D12PU board with each tone lasting for one second. The frequencies of these four tones are 100 Hz, 250 Hz, 500 Hz, and 1000 Hz. 2. Write a C program that will display the number of pushbutton on the rightmost 7-segment display digit when the pushbutton is pressed. The source code is displayed below: #include "hes12.h" #include "delay.h" void SetClk8(void): int main(void) int loop_counts - 500; SetCik80: // set E clock frequency to 24 MHz DDRT = OxFF; //configure PORT T for output while(loop_counts > 0) { PTT = 0x20; delaybylms(1): PTT 0x00; delaybylms(1): loop counts: } while(1): return 0; // // This function enables PLL and use an 8-MHz crystal oscillator to // generate 24-MHz E clock. 11 void SetCik8 (void) { SYNR = 0x02; // set SYSCLK to 24 MHz from a 4-MHz oscillator REFDV = 0; // PLLCTL = 0x60; // tum on PLL, set automatic while(!(CRGFLG & LOCK)): CLKSEL - PLLSEL; // clock derived from PLL 1 Pushbuttons The D12PU board has four pushbuttons located right below the red DIP switch. Pushbutton 3 is the leftmost one. They are connected to bits 3:0 of Port H, and they are active low (when pressed). PRELAB 1. Write a program to generate a four-tone siren using the speaker on D12PU board with each tone lasting for one second. The frequencies of these four tones are 100 Hz, 250 Hz, 500 Hz, and 1000 Hz. 2. Write a C program that will display the number of pushbutton on the rightmost 7-segment display digit when the pushbutton is pressed. The source code is displayed below: #include "hes12.h" #include "delay.h" void SetClk8(void): int main(void) int loop_counts - 500; SetCik80: // set E clock frequency to 24 MHz DDRT = OxFF; //configure PORT T for output while(loop_counts > 0) { PTT = 0x20; delaybylms(1): PTT 0x00; delaybylms(1): loop counts: } while(1): return 0; // // This function enables PLL and use an 8-MHz crystal oscillator to // generate 24-MHz E clock. 11 void SetCik8 (void) { SYNR = 0x02; // set SYSCLK to 24 MHz from a 4-MHz oscillator REFDV = 0; // PLLCTL = 0x60; // tum on PLL, set automatic while(!(CRGFLG & LOCK)): CLKSEL - PLLSEL; // clock derived from PLL 1 Pushbuttons The D12PU board has four pushbuttons located right below the red DIP switch. Pushbutton 3 is the leftmost one. They are connected to bits 3:0 of Port H, and they are active low (when pressed)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!