Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Switches control LED2. 1. Create a new project Lab6a. Copy in your code from Lab 5 that blinked LED1 based on Timer A. Add to

Switches control LED2. 1. Create a new project Lab6a. Copy in your code from Lab 5 that blinked LED1 based on Timer A. Add to your program by making LED2 illuminate whenever either the left button (S1) or right button (S2) is pressed. LED2 should stay on only as long as the button remains pressed.

this is lab 5:

#include // LED P1.0 void main(void) { WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer PM5CTL0 = 0xFFFE; // to enable inputs and outputs //set up LED P1OUT&=~BIT0; // for LED1 set P1.0 to output P1DIR|=BIT0; // turn on LED1 //set up Timer A0 TA0CTL|=TASSEL_1|MC_1|TACLR; //ACLK, count up TA0CCR0=0x8000; //Limit 0x8000 = 32768 // infinite loop for (;;) { if(TA0CTL&TAIFG) //If flag is set from count up { P1OUT^=BIT0; //toggle LED TA0CTL&=~BIT0; //reset flag } } }

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_2

Step: 3

blur-text-image_3

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

Advances In Spatial And Temporal Databases 11th International Symposium Sstd 2009 Aalborg Denmark July 8 10 2009 Proceedings Lncs 5644

Authors: Nikos Mamoulis ,Thomas Seidl ,Kristian Torp ,Ira Assent

2009th Edition

3642029817, 978-3642029813

More Books

Students also viewed these Databases questions

Question

Derive expressions for the rates of forward and reverse reactions?

Answered: 1 week ago

Question

Write an expression for half-life and explain it with a diagram.

Answered: 1 week ago

Question

What do you mean by underwriting of shares ?

Answered: 1 week ago

Question

Define "Rights Issue".

Answered: 1 week ago