<< Chapter < Page Chapter >> Page >
This example shows a first way of measuring time. __no_operation() instructs the MSP430 to do nothing during one cycle; by repeating this many times, time can bemeasured. As this is neither accurate nor energy-efficient, a more elegant technique will be shown in section 3.4 .

Running the code

  • Copy the code presented below Alternatively, this code is available in the downloadable source code . Open source_code/iar_v4.11/lab_ezwsn.eww with IAR. The project corresponding to this section is called led_loop . .
  • Compile and download the code onto the board (Ctrl+D) .
  • Let the code execute (F5) , both LEDs should blink.

#include "io430.h" #include "in430.h"int main( void ) {WDTCTL = WDTPW + WDTHOLD; int i;P1DIR |= 0x03; while (1) {P1OUT ^= 0x03; for (i=0;i<10000;i++) { __no_operation();} }}
Blinking LEDs using an active waiting loop

Some keys for understanding the code:

  • Line 9 : the operator ^= causes 1s to become 0s and vice-versa (aka toggling).In case of our LEDs, it causes their on/off state to change;
  • Line 10 : __no_operation(); causes the MSP430 to do nothing for one cycle.

Measuring time

We want to measure time precisely with the oscilloscope. This can, in theory, be done by measuring the voltage at the LEDs, but it is hard to hold the probes right. We will therefore use extension pin P6 represented in the figure below, which is connected to P2.3 on the MSP430.

extension_pins
The extension pins on the eZ430-RF2500 board. Note that the pins with even number (shown on the right) are located on the edge of the board, and are thus accessible more easily.

We will configure P2.3 to be output and toggle its state together with the state of the LEDs. Therefore:

  • add line P2DIR |= 0x08; after line 7 to declare P2.3 as output;
  • add line P2OUT ^= 0x08; after line 9 to toggle P2.3 after toggling the LEDs;
  • connect a probe of your oscilloscope to extension port P6 , ground on extension port P12 ;
  • power on the board, you're now able to read the duration between two toggles;
  • reprogram your board with waiting values between 1000 and 30000; verify that the times obtained are close to the ones presented the following table.

Duration when using an active waiting loop
threshold value for i measured toggle duration
1000 6.72ms
10000 67.2ms
20000 134.0ms
30000 201.0ms

Questions & Answers

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
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
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
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