Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 4 If any, which line of code is problematic to the function of LEDs toggling? 1#include 3#define TCNTCONST 10000 4 5// Non-blocking using timer

image text in transcribed

Question 4 If any, which line of code is problematic to the function of LEDs toggling? 1#include 3#define TCNTCONST 10000 4 5// Non-blocking using timer interrupt implementation 6 int main(void) f 7 WDTCTL WDTPW WDTHOLD - // Stop watchdog timer 8 II Upon reset CPU frequency is 16MHz // Set P.0 and P3.1 to output direction. We only select these two LEDs to alternate toggling // Arbitrarily set P3.0 to ON // Set PJ.1 to OFF 10 PJDIR-BITO + BITI; 11 PJOUT-BIT0; 12 PJOUT &-BIT1; 13 14 Configure timer A as a clock divider to generate delay 15 TA0cCTLO- CCIE; 16 TAOCTL -TASSEL 2ID 3 MC_1; // Use the SMCLK to clock the counter, SMCLK/8, count up mode 17 TA0CCRe TCNT CONST-1; 18 19 BIS_SR(CPUOFF) 20 disable_interrupt); 21 22 return 0; 23 24 25// TimerA interrupt service routine 26#pragma vector = TIMERO AO VECTOR 27_interrupt void Timer_A (void)f 28 PJOUT-BITO BIT1; 29 30 // Enable counter interrupt on counter compare register // Set maximum count (Interrupt frequency 8MHz/8/TCNT CONST-10Hz) // Enter LPM // Disable interrupts because already set auto startup // Requires a return for new Energia version to be safe from compilation errors // Toggle between PJ.0 and PJ.1 using XOR Note: Type in any integer number between 1-30 inclusive as

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 Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions

Question

Identify external recruitment sources.

Answered: 1 week ago