<< 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 ).


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:

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

anyone know any internet site where one can find nanotechnology papers?
Damian Reply
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
characteristics of micro business
for teaching engĺish at school how nano technology help us
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
what is the actual application of fullerenes nowadays?
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
is Bucky paper clear?
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Do you know which machine is used to that process?
how to fabricate graphene ink ?
for screen printed electrodes ?
What is lattice structure?
s. Reply
of graphene you mean?
or in general
in general
Graphene has a hexagonal structure
On having this app for quite a bit time, Haven't realised there's a chat room in it.
what is biological synthesis of nanoparticles
Sanket Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
many many of nanotubes
what is the k.e before it land
what is the function of carbon nanotubes?
I'm interested in nanotube
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
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
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?