Microprocessor MSP43 Question Please answer all parts. Write the codes for each
ID: 2081409 • Letter: M
Question
Microprocessor MSP43 Question
Please answer all parts.
Write the codes for each of the following statement for MSP430F5438A. Set P2.1 to output Enable the p resistor on P2.5 and set to pulldown resistor Enable interrupt for P1.2 and set the interrupt flag with a low-to-high transition. Reset the interrupt flag for P1.7 Configure the corresponding register to use SMCLK as clock for timer A0 with 1/4 divider and up mode. It should count up to 15000. enable timer A0 for interrupt request and clear the interrupt flag.Explanation / Answer
#include <msp430.h> //msp430.h hearder files automatically find the device specific header file that matches the //target device you picked in the project
int main(void)
{
a)P2DIR |= BIT1; // Set P2.1 (LED) to output direction
b)P2REN |= BIT5; // resistor enabled
P2OUT |= BIT5; // pull up resistor
c)P1IE |= BIT2; // Enable interrupt for P1.2
P1IES &= ~BIT2; // P1.2 Low to high edge
d)P1IFG &= ~BIT7; // Clear interrupt flag for P1.7
}