<< Chapter < Page Chapter >> Page >

You will write ISRs in to response when pushing the button ( 3.3 ), timer interrupts ( 3.4 ) and when receiving a packet at the radio ( 4.2 ).

Timers

When writing code, you may want to wait some time before doing something (e.g. when I receive a packet, wait 10ms, and send a reply packet). This can bedone using a timer, a specific component of the MSP430. Physically, a timer is a 16-bit register which is incremented at each clock cycle, i.e. once every μswith a 1MHz clock. It starts at 0, and counts up until a programmable value, upon whichis generates a timer interrupt, reset to 0, and starts counting up again.

You will use timer in section to have a LED flash at a given rate ( 3.4 ).

I/o functionalities

The MSP430 has 40 pins:

  • 4 have analog functions to power the board;
  • 2 are used for testing at the factory;
  • 2 are used if an external crystal is used as clock source, which is not the case onthe eZ430-RF2500 platform;
  • 32 have digital functions.

The 32 digital pins are grouped into 4 ports of 8 pins each. Each pin has a name inthe form Px.y , y represents the position of the pins within port x . All pins can be generic I/O pins, a number of 8-bit registers are used to configure them:

  • PxDIR.y sets the direction of port PxDIR.y ; output if PxDIR.y=1 , input if PxDIR.y=0 ;
  • PxOUT.y sets the state of port Px.y when set as output;
  • PxIN.y reads the state of port Px.y when set as input;
  • PxIE.y enables interrupts on that port;

Each of these registers hold 8 bits, one for each pin. As a result, P1DIR=0b11110000 0bx means that x is written in binary; 0xx means that x is written in hexadecimal. We thus have 0x1A=0b00011010 . Use Windows Calculator in Scientific mode for quick conversions. means that pins P1.0 through P1.3 are input, while P1.4 through P1.7 are outputs. To set/reset a specific pin, you need to use the binary operators presented inthe following code:

Assuming A = 0b01101001, we have:~A = 0b10010110 A |= 0b00000010: A=0b01101011A&= ~0b00001000: A=0b01100001 A ^= 0b10001000: A=0b11100001A<<2: A=0b10100100 A>>2: A=0b00011010
Binary operators used to set/reset individual bits.

Note that most of the 32 digital pins can also be used for specific functions (SPIinterface, input for Analog-to-Digital conversion, ...), see the MSP430x22x2, MSP430x22x4 Mixed Signal Microcontroller datasheet for details.

Low-power operation

As the MSP430 spends its time waiting for interrupts, it is important to reduce itsenergy consumption during idle periods by shutting down the clocks you are not using. The more clocks you shut down, the less energy you use, but make sure youleave on the clocks you need. There are four low power modes (LPM1, ..., LPM4) which shut down different clocks (details in the MSP430x2xx Family User's Guide ).

In practice, you only need to leave on the auxiliary clock which clocks a timer towake the MSP430 after some time. This is achieved by entering low-power mode 3, by adding this line at the end of your main function:

__bis_SR_register(LPM3_bits);
You now know enough about the MSP430 for this tutorial, but if you want towork with the MSP430, you are strongly advised to read the MSP430x2xx Family User's Guide and the MSP430x22x2, MSP430x22x4 Mixed Signal Microcontroller datasheet (in that order).

Questions & Answers

Preparation and Applications of Nanomaterial for Drug Delivery
Hafiz Reply
Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
Jyoti Reply
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
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
Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
Adin
why?
Adin
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
research.net
kanaga
sciencedirect big data base
Ernesto
Introduction about quantum dots in nanotechnology
Praveena Reply
hi
Loga
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
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!





Source:  OpenStax, Ezwsn: experimenting with wireless sensor networks using the ez430-rf2500. OpenStax CNX. Apr 26, 2009 Download for free at http://cnx.org/content/col10684/1.10
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Ezwsn: experimenting with wireless sensor networks using the ez430-rf2500' conversation and receive update notifications?

Ask