EasyManuals Logo

Texas Instruments MSP430 Student Guide

Texas Instruments MSP430
398 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #119 background imageLoading...
Page #119 background image
Lab 3
Lab 3b Reading a Push Button
GPIO Input Worksheet
1. What three DriverLib functions can setup a GPIO pin for input?
Hint, one place to look would be the MSP430 DriverLib Users Guide found in the
MSP430ware folder: \MSP430ware_1_60_01_11\driverlib\doc\MSP430F5xx_6xx\
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
2. What can happen to an input pin that isn’t tied high or low?
_________________________________________________________________________
_________________________________________________________________________
3. Assuming you need a pull-up resistor for a GPIO input, write the line of code required
to setup
pin P2.1 for input:
_____________________________________________________________________;
4. Complete the following code to read pin P2.1:
volatile unsigned short usiButton1 = 0;
while(1) {
// Read push-button pin (SW1)
usiButton1 = ______________________________________________________;
if ( usiButton1 == GPIO_INPUT_PIN_LOW ) {
// If button is down, turn on LED
GPIO_setOutputHighOnPin( GPIO_PORT_P1, GPIO_PIN0 );
}
else {
// Otherwise, if button is up, turn off LED
GPIO_setOutputLowOnPin( GPIO_PORT_P1, GPIO_PIN0 );
} }
5. In embedded systems, what is the name given to the way in which we are reading the
button?
(Hintit’s not an interrupt.)
_________________________________________________________________________
Check your answers against ours … see the Chapter 3 Appendix.
MSP430 Workshop - Using GPIO with MSP430ware 3 - 29

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