Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Line 56 in Illustration 12 in the ISR resets BIT3 . Why? This reloads the vector This resets the SW1 individual interrupt This toggles the

Line 56 in Illustration 12 in the ISR resets BIT3 . Why?

This reloads the vector
This resets the SW1 individual interrupt
This toggles the CPU interrupt enable
This clears the transmit registers

Line 42 in Illustration 12 enables Port 2 Bit 3 (Switch 1) to trigger an interrupt. What other instruction is needed to allow CPU to actually be interrupted?

#Pragma Line 52
Interrupt Line 53
IFG cleared Line 43
GIE Line 46

Line 38 in Illustration 12, how does the instruction enable the pull-up resistor for Switch 1?

The output bit drives the resistor to an open line
The output bit isolates the resistor
The output bit drives the resistor to GND

The output bit drives the resistor to V+

Lines 24-43 in Illustration 12 would be what if Arduino style was used?

ISR
#Define
Loop
Setup

image text in transcribed

1. Single Sentence: Blink the LED with an Interrupt created by pressing a Butto 2. 3. 5. P2.3 Push button SW1 so button is BIT3 on Port 2 6. All of these operations are 8 bit (byte) writes P3DIR &BIT /BIT3 off, dic is input 8. P3RENBIT/BIT3 on, Enable internal pull-up register 9. P3OUTBIT3 10. // BIT3 on, set gutbit to pull-up 11 P3IES -BIT: BIT3 on, trigger edge rise/fall 12. P3IFG& BITE/BITB gftdleac interrupt flag 13. P3IE-BIT// BIT3 on, set interrupt enable 14. 15. #include 16. 17 18. P1.O Red LED 20. 21. 22. int main(void) 23 24. WDTCTL WDTPW+WDTHOLD: I/Stop watchdog timer 26. /Disable the GPIO power-on default high-impedance mode 27. I/to activate previously configured port settings 28. PMSCTLO & LOCKLPM5Woff 29 30. /set LED output bit 31. P1DIR-BITO;// on, Set P1.0 to output direction 32. / start with LED off 33. P10UT & BITO;// P1.0 off (LED OFF 34. 35. /P2.3 input switch (all writes are 8 bits) 36. P2DIR&-BIT3I set P2.3 as input bit (input default power-up) 37. P20UT |-BITE. // BIT3 on, set 9wbitto pull-up 38. P2REN |; BITa_// BIT3 0n. Enable internal pull up register 39. 40. P2IES -BIT// One is Falling edge 41. 42. P2IE BITBIT3 on, P2.3 interrupt enabled 43. P2IFG &"BIT3-// BIT3 off, P2.3 IFG cleared 45. /LPM4- shut down-0.49uA-OFF Section 6.3 SLASES9B 46. is SR resister LPM4_bits GIE)I/ LPM4 with interrupts enabled 50. 51. //Port 2 interrupt service routine 52. #pragma vector=PORT2 VECTOR 3 interrupt void Port_2 void) 54. 55. P1OUTA BITO; // P10 toggle lxg) 56. P2IFG &BIT3;/ P2.3 IFG off (cleared) 57. 58. // P21ES . BIT3:// toggle (Sc) the interrupt edge. 59. /the interrupt vector will be called 60. I/when P2.3 goes from Hitelew as well as LautaHieh 61, 1 1. Single Sentence: Blink the LED with an Interrupt created by pressing a Butto 2. 3. 5. P2.3 Push button SW1 so button is BIT3 on Port 2 6. All of these operations are 8 bit (byte) writes P3DIR &BIT /BIT3 off, dic is input 8. P3RENBIT/BIT3 on, Enable internal pull-up register 9. P3OUTBIT3 10. // BIT3 on, set gutbit to pull-up 11 P3IES -BIT: BIT3 on, trigger edge rise/fall 12. P3IFG& BITE/BITB gftdleac interrupt flag 13. P3IE-BIT// BIT3 on, set interrupt enable 14. 15. #include 16. 17 18. P1.O Red LED 20. 21. 22. int main(void) 23 24. WDTCTL WDTPW+WDTHOLD: I/Stop watchdog timer 26. /Disable the GPIO power-on default high-impedance mode 27. I/to activate previously configured port settings 28. PMSCTLO & LOCKLPM5Woff 29 30. /set LED output bit 31. P1DIR-BITO;// on, Set P1.0 to output direction 32. / start with LED off 33. P10UT & BITO;// P1.0 off (LED OFF 34. 35. /P2.3 input switch (all writes are 8 bits) 36. P2DIR&-BIT3I set P2.3 as input bit (input default power-up) 37. P20UT |-BITE. // BIT3 on, set 9wbitto pull-up 38. P2REN |; BITa_// BIT3 0n. Enable internal pull up register 39. 40. P2IES -BIT// One is Falling edge 41. 42. P2IE BITBIT3 on, P2.3 interrupt enabled 43. P2IFG &"BIT3-// BIT3 off, P2.3 IFG cleared 45. /LPM4- shut down-0.49uA-OFF Section 6.3 SLASES9B 46. is SR resister LPM4_bits GIE)I/ LPM4 with interrupts enabled 50. 51. //Port 2 interrupt service routine 52. #pragma vector=PORT2 VECTOR 3 interrupt void Port_2 void) 54. 55. P1OUTA BITO; // P10 toggle lxg) 56. P2IFG &BIT3;/ P2.3 IFG off (cleared) 57. 58. // P21ES . BIT3:// toggle (Sc) the interrupt edge. 59. /the interrupt vector will be called 60. I/when P2.3 goes from Hitelew as well as LautaHieh 61, 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions