Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is C programs to control LEDs by a switch and modification of Timer A. can you please add comments after ; in each line.

This is C programs to control LEDs by a switch and modification of Timer A. can you please add comments after ; in each line. please do them all and explain what it does to the program.

}image text in transcribedimage text in transcribed

#include // To simply include a header file of the Microcontroller Launchpad // assumes LED1 = Pl.0 void main(void) //The main Function with a return type void int WDTCTLWDTPW | WDTHOLD; // to stop the watchdog timer PM5CTL0 = 0xFFFE; // to enable both the inputs and outputs To declare the variable"i" simply as integer type //SET UP LED P1OUT & ~BIT0; // to turn off LEDI P1DIR BIT0; // for LED1 set P1.0 to output P9DIR BIT7; P1RENBIT1; P1OUTBIT1; P1RENBIT2; P1OUTBIT2; /SET UP TIMER TAeCTL -TASSEL_1 | MC 1 TACLR; II configuring the timer TA0CCR0 = 0x8000; // to set terminal count to Hexadecimal /INFINITE LOOP while (1) if (TA0CTL & TAI FG) // Check both TA0CTL and TAIFG (tiner nterrupt flag) P1OUT ^= BIT0; /simply toggle bit 0 of the Port 1 with a or 1 TA0CTL &BITe; // to reset bit e of TA if ((BIT1 & PIIN) == 0 11 (BIT2 & PIIN) 0) // set s1 and s2 button P9OUT I-BIT7; // toggle bit of the Port 1 with a or 1 ellse // Lab6b #include // - To simply include a header file of the Microcontroller Launchpad // assumes LED1 = Pl.0 void main(void) //The main Function with a return type void WDTCTL WDTPW | WDTHOLD; // to stop the Watchdog timer PM5CTL0 = 0xFFFE; // to enable both the inputs and outputs //SET UP LED P1OUT &= ~BIT0; // turn LED1 on PIDIR I- BIT9wt/ for LED1 set P1.0 to output P9OUT &= nB1T7; // turn LED2 on P9DIRBITZ for LED2 set P9.7 to output PIDIR &= ~BIT1; // P1DIR &- ~BIT2; // /I Timer: TAOCTLTASSEL 1 MC 1 TACLR: I/ timer at ACLK TA0CCR0 = 0x8000; // the maximum value to count to while (1) // infinite loop if (TA0CTL & TA FG) // - Check both TA0CTL and TAI FG (tiner interrupt flag) P10UT ^ BITQndU - simply toggle bit 0 of the Port 1 with a 0 or 1 8- ~BIT0; //ww to reset bit of TAO if ((BIT! & PIIN)-0 && TA0CCRO // To simply include a header file of the Microcontroller Launchpad // assumes LED1 = Pl.0 void main(void) //The main Function with a return type void int WDTCTLWDTPW | WDTHOLD; // to stop the watchdog timer PM5CTL0 = 0xFFFE; // to enable both the inputs and outputs To declare the variable"i" simply as integer type //SET UP LED P1OUT & ~BIT0; // to turn off LEDI P1DIR BIT0; // for LED1 set P1.0 to output P9DIR BIT7; P1RENBIT1; P1OUTBIT1; P1RENBIT2; P1OUTBIT2; /SET UP TIMER TAeCTL -TASSEL_1 | MC 1 TACLR; II configuring the timer TA0CCR0 = 0x8000; // to set terminal count to Hexadecimal /INFINITE LOOP while (1) if (TA0CTL & TAI FG) // Check both TA0CTL and TAIFG (tiner nterrupt flag) P1OUT ^= BIT0; /simply toggle bit 0 of the Port 1 with a or 1 TA0CTL &BITe; // to reset bit e of TA if ((BIT1 & PIIN) == 0 11 (BIT2 & PIIN) 0) // set s1 and s2 button P9OUT I-BIT7; // toggle bit of the Port 1 with a or 1 ellse // Lab6b #include // - To simply include a header file of the Microcontroller Launchpad // assumes LED1 = Pl.0 void main(void) //The main Function with a return type void WDTCTL WDTPW | WDTHOLD; // to stop the Watchdog timer PM5CTL0 = 0xFFFE; // to enable both the inputs and outputs //SET UP LED P1OUT &= ~BIT0; // turn LED1 on PIDIR I- BIT9wt/ for LED1 set P1.0 to output P9OUT &= nB1T7; // turn LED2 on P9DIRBITZ for LED2 set P9.7 to output PIDIR &= ~BIT1; // P1DIR &- ~BIT2; // /I Timer: TAOCTLTASSEL 1 MC 1 TACLR: I/ timer at ACLK TA0CCR0 = 0x8000; // the maximum value to count to while (1) // infinite loop if (TA0CTL & TA FG) // - Check both TA0CTL and TAI FG (tiner interrupt flag) P10UT ^ BITQndU - simply toggle bit 0 of the Port 1 with a 0 or 1 8- ~BIT0; //ww to reset bit of TAO if ((BIT! & PIIN)-0 && TA0CCRO

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions

Question

if it has two threads that can make reqeusts concurrently

Answered: 1 week ago

Question

Choosing Your Topic Researching the Topic

Answered: 1 week ago

Question

The Power of Public Speaking Clarifying the

Answered: 1 week ago