EasyManuals Logo

Texas Instruments MSP430 Student Guide

Texas Instruments MSP430
398 pages
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #398 background imageLoading...
Page #398 background image
Lab Debrief
8 - 40 Gettings Started with the MSP430 - Using Energia (Arduino)
Q&A: Lab8C (3)
Another Pushbutton/Serial Example (StateChangeDetection sketch)
12. Examine the sketch, download and run it.
How is this sketch different? What makes it more efficient?
_____________________________________________________________________
How is this (and all our sketches, up to this point) inefficient?
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
It only sends data over the UART whenever the button changes
Our pushbutton sketchs thusfar have used polling to determine the state of the
button. It would be more efficient to let the processor sleep; then be woken up by an
interrupt generated when the pushbutton is depressed.
Q&A: Lab8D
Interrupt Example (Interrupt_PushButton)
7. Look up the attachInterrupt() function. What three parameters are required?
1. _____________________________________________________________
2. _____________________________________________________________
3. _____________________________________________________________
8. Compile & download your code and test it out.
Does the green RED_LED flash continuously? _____________________________
When you push the button, does the GREEN_LED light? _____________________
Notes:
Use reset button to start program again and clear GREEN_LED
Most common error, not configuring PUSH2 with INPUT_PULLUP.
Interrupt source – in our case, it’s PUSH2
ISR function to be called when int is triggered – for our ex, it’s “myISR”
Mode – what state change to detect; the most common is “FALLING”

Table of Contents

Other manuals for Texas Instruments MSP430

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments MSP430 and is the answer not in the manual?

Texas Instruments MSP430 Specifications

General IconGeneral
BrandTexas Instruments
ModelMSP430
CategoryMicrocontrollers
LanguageEnglish

Related product manuals