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

tro. to Dr. B n Alhalabi, EE512 fill in the comments next to the to indicate the

ID: 3820401 • Letter: T

Question

tro. to Dr. B n Alhalabi, EE512 fill in the comments next to the to indicate the functo ll inspired by th llol the following C program, per be of the nding line. Be no more than one line existing comments. ILEDI mounted on bito as an output winclude Kdefine LEDI BIT0 BIT6 ade fine BUTTON BIT3 #define unsigned int folds-1; int i void main(void) Instop watchdog timer zero wDTCTL-wDTPw WDTHOLD: outputs are lfmake sure all default llenables internal resistor on the button pin PIOUT OLEDIILED2); PIDIR. PIREN 1- BUTTON: PILES BUTTON. llenable interrupts activities PIE enable interrupt0; LED2 on P1.6 using XOR INogsde of times equal to folds, llfor a number for (LED2) For (i-1 folds, delay (100000);) cycles ckinning of interrupt service

Explanation / Answer

Here is the comments of all parts of coding as per given criteria, please go through it throughly.

#define LED1 BIT0 //LED1 mounted on bit0 as an output
#define LED2 BIT6 //LED2 mounted on bit6 as an output
#define BUTTON BIT3 //Button mounted on bit3

Unsigned int folds=1;
int i=1;

void main(void)   
WDTCTL =WDTPW + WDTHOLD; //Stop watchdog timer

P1OUT = 0x00; // make sure all default output are zero
P1DIR = (LED1|LED2); // set bit0, bit6 as output

P1REN |= BUTTON; //enables internal resistor on the button pin
P1OUT &=~BUTTON; // set BIT3 to off
P1IES &=~BUTTON; // BIT3 high to low edge
P1IE |= BUTTON; // enable interrupt on BIT3
__enable_interrupt(); //enable interupts activities

for(;;)
{
P1OUT^=(LED2);
//toggle LED2 on P1.6 using XOR
For(i=1; i<=folds;i++) // for a number of times equal to folds,
{__delay_cycles(100000);} // delay for a while


}
}

Thankyou