<< Chapter < Page Chapter >> Page >
Use the S1 button in the MSP430-EXP430FG4618 development tool and in the eZ430-RF2500 kit to toggle the state of LED1. You must use interrupts to catch the button press and you should ensure that the MSP430 is in Lower Power Mode 3 when is not in use.

Laboratory gpio: lab3 - toggle the led state by pressing the push button

Introduction

The hands-on laboratory consists of configuring the I/O ports, setting up the input lines to read push buttons and the output lines to feed LEDs. The following exercises have been developed for the three hardware development tools.

The first to be discussed is the MSP-EXP430FG4618 Experimenter’s board. Modifications are later made to suit the other development boards. The main differences between the boards are related to the specific ports in which the buttons and LED are (or can be) connected. For the development of this laboratory, Code Composer Essentials v3 has been used.

Procedure

By analysis of the schematics, determine to which port pin the push button is connected:

- Consult the MSP430FG4618/F2013 Experimenter’s Board User's Guide<slau213a.pdf>:

- Button S1 is connected to Port 1.0;

- Consult the eZ430-RF2500 Development Tool User's Guide<slau227a.pdf>:

- Button S1 is connected to Port 1.2;

- The eZ430-RF2500 uses a device in 2xx family, so you need to additionally configure the button as pull-up or pull-down, in the P1REN register.

Ports control registers:

- Set push button pin port as an input

- P1DIR: Port 1.0 is set as an input:

P1DIR&= ~0x01 // to force the pin setting to 0. It is uses an AND operation (&) between P1DIR and 0xFE

- Enable interrupts to this pin port;

- P1IE: Enable interrupt to port 1.0:

P1IE |= 0x01; // Interrupt Enable in P1.0

- PIIES: Call the port interrupt on a high-to-low transition:

P1IES |= 0x01; // P1.0 Interrupt flag high-to-low transition

- Configure the watchdog timer to prevent a PUC during the program execution;

WDTCTL = WDTPW | WDTHOLD; //Stop Watchdog Timer

- Enable Global Interrupts and configure low power mode 3;

_BIS_SR (LPM3_bits + GIE); //Low Power Mode with interrupts enabled

- Create a interrupt service routine, that includes:

- Toggle LED1 pin port;

- Delay for button debounce;

- Clear interrupt flag.

#pragma vector=PORT1_VECTOR __interrupt void Port_1 (void) {volatile unsigned int i; P2OUT ^= 0x04; // Toggle Port P2.2i=1500; // Delay, button debounce do (i--);while (i !=0); while (! (P1IN&0x01)); // Wait for the release of the button i=1500; // Delay, button debouncedo (i--); while (i !=0);P1IFG&= ~0x01; // Clean P1.0 Interrupt Flag }

This example and many others are available on the MSP430 Teaching ROM.

Request this ROM, and our other Teaching Materials here (External Link)

Questions & Answers

how can chip be made from sand
Eke Reply
are nano particles real
Missy Reply
yeah
Joseph
Hello, if I study Physics teacher in bachelor, can I study Nanotechnology in master?
Lale Reply
no can't
Lohitha
where we get a research paper on Nano chemistry....?
Maira Reply
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
Ali
what are the products of Nano chemistry?
Maira Reply
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
Google
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
hey
Giriraj
Preparation and Applications of Nanomaterial for Drug Delivery
Hafiz Reply
revolt
da
Application of nanotechnology in medicine
has a lot of application modern world
Kamaluddeen
yes
narayan
what is variations in raman spectra for nanomaterials
Jyoti Reply
ya I also want to know the raman spectra
Bhagvanji
I only see partial conversation and what's the question here!
Crow Reply
what about nanotechnology for water purification
RAW Reply
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
Brian Reply
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
LITNING Reply
what is a peer
LITNING Reply
What is meant by 'nano scale'?
LITNING Reply
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Good
Berger describes sociologists as concerned with
Mueller Reply
what is hormones?
Wellington
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Teaching and classroom laboratories based on the “ez430” and "experimenter's board" msp430 microcontroller platforms and code composer essentials. OpenStax CNX. May 19, 2009 Download for free at http://cnx.org/content/col10706/1.3
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Teaching and classroom laboratories based on the “ez430” and "experimenter's board" msp430 microcontroller platforms and code composer essentials' conversation and receive update notifications?

Ask