Question: need help in code composer for the three objectived listed above, preliminary code provided 1- Interrupts and Programming Model Interrupts will be discussed in the

 need help in code composer for the three objectived listed above,

preliminary code provided 1- Interrupts and Programming Model Interrupts will be discussed

in the lecture but in a nutshell they are a mechanism to

take control of the processor based on a hard-ware request. The processor

gracefully completes the current instruction and then services" the interrupt by running

need help in code composer for the three objectived listed above, preliminary code provided

1- Interrupts and Programming Model Interrupts will be discussed in the lecture but in a nutshell they are a mechanism to take control of the processor based on a hard-ware request. The processor gracefully completes the current instruction and then services" the interrupt by running the code defined in an interrupt service routine. There are many sources of interrupts within the MSP430, but in this lab we are going to focus on the general purpose input on P1.3 which is attached to the push button. An interrupt on P1.3 can be enabled by controlling several Port 1 registers P1IE is a register that enables interrupts for port 1 pins. P1IES is the resister that determines (if interrupts are enabled for the corresponding pin) which edge (rising or falling) causes an interrupt P1IFG is the register in which each PxIFGx bit is the interrupt flag for its corresponding I/O pin and is set when the selected input signal edge occurs at the pin. All PxlFGx interrupt flags request an interrupt when their corresponding PxIE bit and the GIE bit are set. Each PxIFG flag must be reset with software. Software can also set each PxIFG flag. providing a way to generate a software initiated interrupt. Bit - 0: No interrupt is pending Bit = 1: An interrupt is pending Only transitions, not static levels, cause interrupts. If any PxlFGx flag becomes set during a Px interrupt service routine, or is set after the RETI instruction of a Px interrupt service routine is executed, the set PxlFGx flag generates another interrupt. This ensures that each transition is acknowledged. The interrupt flags should be cleared and then finally, the interrupts should be enabled globally. These three lines perform the function described in this case. 2 - Introduction to C with the MSP430 TI has extensive documentation on the Code Composer Studio. You can find all here. To create a CCS project, select CCS Project" in the file-snew menu. Select an "Empty Project" in order to create a C project New CCS Project CCs Project Create a new CCS Project Project name Output type: Execkable ense deaa location Deevice Famy MEP430 Variant:celect or type fiker text Connectionc TI MSP430 USB [Defut MSP43062553 Advanced settings Project templates and ecamples Creates an empty projert fully inibalized for the selected devicse El Empty Projects Empty Assembly-only Proect Empty RT Project Enply Gace (MSP430) Project Basc Examples Birk The LED HI world Cancel A new project will be created with a main.c file include that will be empty. Paste the following program into the main.c and load the program to your Launchpad in the same manner as you have done with the previous assembly projects /I MSP430 Blink the LED Demo - Software Toggle P1.0 and P1.6 ll Description; Toggle P1.0 by xoring P1.0 inside of a software loop. // ACLK " n/a. MCLK = SMCLK = default DCO MSP430 XIN- IRST XOUTI- P1.0)-LED1 P1.61 >LED2 #include int main(void) wDTCTL = wDTPW + WDTHOLD: // Stop watchdog timer PIDIR:0x41; P1REN 0x08: Turn on pull up resistor to push button P1OUT 0x49; Drive high voltages to both LEDs while (1) /ll Set P1.0 and P1.6 to outputs f endless while loop condition is always true (one) volatile unsigned int i; I volatile to prevent optimization P1OUT ^= 0x41; for(i-0:i 20000+ ll empty for loop for delay - change number Il Toggle P1.0 and P1.6 using exclusive-OR This program programs the two LEDs and push button and starts an endless loop that toggles the LEDs. Change the number in the for loop to change the frequency of blinking 3 - Interrupts Service Routine In order to implement an interrupt in C, you will need to program the MSP430 to enable the specific interrupt as necessary. The actual interrupt service routine (function that will be executed after each interrupt) needs to be described in your main.c file using the code word "pragma". Shown below is an example of a port 1 interrupt service routine. You will need to add your specific code and clear the interrupt flag to acknowledge the interrupt. First, you need to configure the interrupt and enable interrupts globally. Then, add the code below to the end and update it. // Port 1 interrupt service routine #pragma vector-PORT 1-VECTOR interrupt void Port_1(void) // Add INTERRUPT SERVICE ROUTINE HERE. P11FG &BUTTON;// P1.3 IFG cleared 1. Write a C program that use interrupts on P1.3 (push button) to change the state of the P1.6 LED (that is one push turns it on, another off, etc.). 2. After configuration, enter an endless loop that does nothing (e.g. interrupts are in control and the main program should do nothing) or alternatively enter a low power mode for 5 extra points to the lab grade. Question: Look at the MSP430 Datasheet and identify all functions available for pin P1.6. Also, when used as an output, how much current can pin P1.6 source or sink

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!