Question

In: Computer Science

Please answer using MSP design and program for C. Write CCS code. outline the program for...

Please answer using MSP design and program for C.
Write CCS code.
outline the program for MSP design, and program for C.

Make a project that uses one timer on the board to control the blinking of the LED. Basically setup a timer interupt. Whenever the timer interrupt happens, the LED blinks. The frequency of the
blinking is chosen by the user.

Next modify the program above and make a project that uses one of the pushbuttons on the board to control the frequency of the LED blinking. Essentially, choose one frequency in the timer interrupt, and then setup a button for a interrupt routine. Whenever the pushbutton interrupt occurs, the frequency of the LED blinking slows down by half until it reaches the minimum frequency. The minimum frequency
of the blinking is chosen in the previous problem so keep the same.

Again please use MSP design and have it able to program in C.
I will up vote if done correctly, thanks!

Solutions

Expert Solution

#include "msp430g2231.h"  
  
void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;     // Stop WDT  
  CCTL0 = CCIE;                             // CCR0 interrupt enabled
  TACTL = TASSEL_2 + MC_1 + ID_3;           // SMCLK/8, upmode
  CCR0 =  10000;                     // 12.5 Hz   
  P1OUT &= 0x00;               // Shut down everything
  P1DIR &= 0x00;               
  P1DIR |= BIT0 + BIT6;            // P1.0 and P1.6 pins output the rest are input 
  P1REN |= BIT3;                   // Enable internal pull-up/down resistors
  P1OUT |= BIT3;                   //Select pull-up mode for P1.3
  P1IE |= BIT3;                       // P1.3 interrupt enabled
  P1IES |= BIT3;                     // P1.3 Hi/lo edge
  P1IFG &= ~BIT3;                  // P1.3 IFG cleared
  _BIS_SR(CPUOFF + GIE);          // Enter LPM0 w/ interrupt 
  while(1)                          //Loop forever, we work with interrupts!
  {}
} 
  
// Timer A0 interrupt service routine 
#pragma vector=TIMERA0_VECTOR 
__interrupt void Timer_A (void) 
{   
   P1OUT ^= BIT0;                          // Toggle P1.0 
} 
// Port 1 interrupt service routine
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{    
   P1OUT ^= BIT6;                      // Toggle P1.6
   P1IFG &= ~BIT3;                     // P1.3 IFG cleared 
}

Related Solutions

Please answer QC,D,E,F using the code provided at the end please. A. Write C code to...
Please answer QC,D,E,F using the code provided at the end please. A. Write C code to define a structure called date that has three fields day, month, year, all of which are ints. B. Write C code to define a structure called person that has fields for name (50 char array), dateOfBirth (date struct from Q1), address (200 char array), phoneNum (20 char array), and ID (int). C. Write a C program that uses the person structure from Q2, and...
Code in C# please. Write a program that will use the greedy algorithm. This program will...
Code in C# please. Write a program that will use the greedy algorithm. This program will ask a user to enter the cost of an item. This program will ask the user to enter the amount the user is paying. This program will return the change after subtracting the item cost by the amount paid. Using the greedy algorithm, the code should check for the type of bill. Example: Cost of item is $15.50 User pays a $20 bill $20...
Please if you are able to answer the question below: Write C++ program using native C++...
Please if you are able to answer the question below: Write C++ program using native C++ (you can use STL)  that produces Huffman code for a string of text entered by the user.  Must accept all ASCII characters.  Pleas explain how you got frequencies of characters, how you sorted them, how you got codes.
Please answer with code for C language Problem: Counting Numbers Write a program that keeps taking...
Please answer with code for C language Problem: Counting Numbers Write a program that keeps taking integers until the user enters -100. In the end, the program should display the count of positive, negative (excluding that -100) and zeros entered. Sample Input/Output 1: Input the number: 0 2 3 -9 -6 -4 -100 Number of positive numbers: 2 Number of Negative numbers: 3 Number of Zero: 1
Please code in C# - (C - Sharp) Assignment Description Write out a program that will...
Please code in C# - (C - Sharp) Assignment Description Write out a program that will ask the user for their name; the length and width of a rectangle; and the length of a square. The program will then output the input name; the area and perimeter of a rectangle with the dimensions they input; and the area and perimeter of a square with the length they input. Tasks The program needs to contain the following A comment header containing...
Please code in c# (C-Sharp) Write a program that will ask the user for their name....
Please code in c# (C-Sharp) Write a program that will ask the user for their name. If the user does not input anything, display a warning before continuing. The program will then ask the user whether they want to have an addition, subtraction, multiplication, or division problem. Once the user indicates their choice, the program will display 2 randomly generated numbers from 1 to 9 in a math problem matching the user’s choice. Example: user selects addition, the equation presented...
*Please write code in C++* Write a program to verify the validity of the user entered...
*Please write code in C++* Write a program to verify the validity of the user entered email address.   if email is valid : output the stating that given email is valid. ex: "The email [email protected] is valid" else : output the statement that the email is invalid and list all the violations ex:  "The email sarahwinchester.com is invalid" * @ symbol * Missing Domain name The program should keep validating emails until user enter 'q' Upload your source code. ex: main.cpp
answer the following using C# Design and program a Visual Studio Console project in C# that...
answer the following using C# Design and program a Visual Studio Console project in C# that allows your user to enter a number. The program will examine the number to see if it is prime. If it is prime, it will print the next higher prime and the next lower primes to the console. If the number entered by the user is not prime, display a message to that effect. All code should be written by you. Do not copy/paste...
Write a code for simple racing game (using dots) on c program.
Write a code for simple racing game (using dots) on c program.
Please write code in C, thank you. Write a program that reads a list of integers,...
Please write code in C, thank you. Write a program that reads a list of integers, and outputs whether the list contains all even numbers, odd numbers, or neither. The input begins with an integer indicating the number of integers that follow. Assume that the list will always contain less than 20 integers. Ex: If the input is: 5 2 4 6 8 10 the output is: all even Ex: If the input is: 5 1 3 5 7 9...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT