Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Microprocessor MSP430 Question Please answer the two parts. Thanks in advance :)

ID: 3807620 • Letter: M

Question

Microprocessor MSP430 Question

Please answer the two parts.

Thanks in advance :)

(21 pts) Complete the program based on the comments. #include int main(void) Stop watchdog timer set P6.0, P6.1 and P6.2 to output direction ll set LED1 and LED 3 on, LED2 off (active high) use timer A0, select clock source ACLK, upmode, clear TAR. set TA0CCRO so the timer can generate an interrupt request every 0.25 second ll enables the interrupt request of the corresponding CCIFG flag. enable interrupt0; ll Timer A0 interrupt service routine #pragma vector TIMERO A0 VECTOR. interrupt void TIMEROLA0 ISR(void) ll toggle LED1, LED2, and LED3

Explanation / Answer

Solution:

Part A:

#include<msp430.h>

Int main (void)

{

WDTCTL=WDTPM+WDTHOLD; //Watchdog timer is stopped

P1DIR|=BIT6;

P1DIR|&=~BIT7;

P1REN|=BIT7;

P1OUT|=BIT7;

P1IE|=BIT7;

P1IES&=~BIT7;

P1IEG&=~BIT7;

_enable _interrupt ();

}

//#include<msp430.h>It finds the header file matches target of the device in project

//WDTHOLD-when bit=1, Watchdog timer is turned off

//WDTCTL-passwords Are protected access to watchdog timer control

//WDTPW-It is timer password. Can be reads as069h and written as 5Ah

//P1DIR|=BIT6-It performs the LED Operation P6.1, P6.1, P6.2to desired output direction

//P1DIR&=~BIT7-performs the push operation of port 1 p1.7 as input

//P1OUT^=BIT6; the toggle operation of all LED

//P1IFG&=~BIT7 it performs the removal of interrupt flag P1.7

//P1REN|=BIT7;It enables all the resistors

//P1IENS&=~BIT7;Set the LED to input and out put

//Timer A0 in interrupt service routine

#pragma vector=PORT1-VECTOR

_interrupt void PORT1_ISR (void)

{

P1OUT^=BIT6;

P1IFE&=~BIT7;

}