Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Goal : To become familiar with using Buzzer on Dragon12-Light boards, the timer output compare function, and interrupt method, as well as to improve your

Goal: To become familiar with using Buzzer on Dragon12-Light boards, the timer output compare function, and interrupt method, as well as to improve your programming skills.

Project: Write a C program to do the following:

Write your own program to turn the Buzzer on and off in exactly one millisecond frequency by using the timer output compare and interrupt method.

The Buzzer is connected to PT5 of the port T. In your main program, you need to write codes to configure PT5 and timer channel 5 so that interrupt for channel 5 output compare is enabled, and PT5 is configured in toggle mode. You need to write an interrupt service routine for timer channel 5 to provide a one millisecond delay (or interrupt).

In EVB (or Debug) mode, the clock frequency for instructions is 24MHz. Use a variable called ClockCycles that provides the correct number of clock cycles for the service routine to generate exactly one millisecond delay. This variable is similar to the variable Period in the example program Buzzer.txt.

Here is the example program Buzzer

//***************************************************************** // Include derivative-specific definitions //***************************************************************** //The microcontroller chip used by Dragon12-Light boards #include /* derivative information */

//***************************************************************** // Gloable Variables //*****************************************************************

//***************************************************************** // Function Prototype //***************************************************************** void MSDelay(unsigned int, unsigned in);

//***************************************************************** // Main program section //***************************************************************** void main(void) { DDRT = DDRT | 0b00100000; //PTT5 as output for (;;) { PTT = PTT | 0x20; //make PT5=1 MSDelay(70, 70); //change the delay size to see what happens PTT = PTT & 0xDF; //Make PT5=0 MSDelay(70, 70); //change delay size....

}

}

//***************************************************************** // Subroutine: MSDelay //***************************************************************** void MSDelay(unsigned int itime, unsigned int jtime) //msec delay { unsigned int i; unsigned int j; for(i=0;i

//***************************************************************** // Interrupt Service Routines //*****************************************************************

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

=+Where does the focus of labor relations lie? Is it collective

Answered: 1 week ago

Question

=+With whom does the firm have to negotiate?

Answered: 1 week ago