<< Chapter < Page Chapter >> Page >

The experimental setting goes as follows. You will have two boards, both sampling periodically sampling the channel. When they are not sampling the channel, theCC2500 is switched off and the MSP enters low-power mode. When you press a button on one board, it sends a preamble cut into 50 micro-frames; the receiverhears a micro-frame and keeps listening until it hears the last one.

To this end:

  • Program two board with the code taken from listing 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 txrx_preamble_msp . ; one will be the transmitter, the other the receiver.
  • Plug in one of the board into the computer and use PuTTY to read from its COMx port; this will be the receiver.
  • press on the transmitter's button, you should read 03 02 01 on your screen.

#include "mrfi.h" #include "radios/family1/mrfi_spi.h"void start_slow_timeout() {TACTL|=TACLR; TACCTL0=CCIE; TACTL=TASSEL_1+MC_1; }void stop_slow_timeout() {TACTL=MC_0; TACCTL0=0; }void start_fast_timeout() {TBCTL|=TBCLR; TBCCTL0=CCIE; TBCTL=TBSSEL_2+MC_1; }void stop_fast_timeout() {TBCTL=MC_0; TBCCTL0=0; }void print_counter(int8_t counter) {char output[] = {" "};output[0] = '0'+((counter/10)%10);output[1] = '0'+ (counter%10);TXString(output, (sizeof output)-1); }int main(void) {BSP_Init(); P1REN |= 0x04;P1IE |= 0x04; MRFI_Init();P3SEL |= 0x30; // P3.4,5 = USCI_A0 TXD/RXD UCA0CTL1 = UCSSEL_2; // SMCLKUCA0BR0 = 0x41; // 9600 from 8Mhz UCA0BR1 = 0x3;UCA0MCTL = UCBRS_2; UCA0CTL1&= ~UCSWRST; // Initialize USCI state machine IE2 |= UCA0RXIE; // Enable USCI_A0 RX interruptBCSCTL3 |= LFXT1S_2; TACTL=MC_0; TACCTL0=0; TACCR0=1060; //slow timeout TBCTL=MC_0; TBCCTL0=0; TBCCR0=31781; //fast timeoutstart_slow_timeout(); __bis_SR_register(GIE+LPM3_bits);} void MRFI_RxCompleteISR(){ mrfiPacket_t packet;stop_fast_timeout(); stop_slow_timeout();MRFI_Receive(&packet); if (packet.frame[9]<4) { print_counter(packet.frame[9]); start_slow_timeout();} else { MRFI_WakeUp();MRFI_RxOn(); }} #pragma vector=PORT1_VECTOR__interrupt void interrupt_button (void) {P1IFG&= ~0x04; uint8_t counter;mrfiPacket_t packet; packet.frame[0]=8+20; MRFI_WakeUp();for (counter=50;counter>=1;counter--) { packet.frame[9]=counter; MRFI_Transmit(&packet, MRFI_TX_TYPE_FORCED); }} #pragma vector=TIMERA0_VECTOR__interrupt void interrupt_slow_timeout (void) {MRFI_WakeUp(); MRFI_RxOn();start_fast_timeout(); __bic_SR_register_on_exit(SCG1+SCG0);} #pragma vector=TIMERB0_VECTOR__interrupt void interrupt_fast_timeout (void) {stop_fast_timeout(); MRFI_Sleep();__bis_SR_register_on_exit(LPM3_bits); }

Some keys for understanding the code:

  • The microcontroller handles two timeouts, one for measuring CI , the other for Dcca . Those timeouts are sourced by two different clocks: a fast and accurate clock for Dcca ; a slower, less accurate but extremely energy-efficient clock for CI . The fast clock is the Digitally Controlled Oscillator ( DCO on Timer A) while the very-low-power, low-frequency oscillator ( VLO on Timer B) is the slow clock. Because CI is triggered by the slow clock, that clock stays on all the time. Only when the slow timeout expires does the microcontroller start the fast clock to clock the fast timeout ( Dcca ); and stops it when that expires. The radio is on only during Dcca .
  • Line 38 initializes the slow timeout on Timer A
  • Line 39 initializes the slow timeout on Timer B
  • Line 42. Because the slow clock runs all the time, the board can only enter LPM3 which leaves the VLO clock running.
  • Line 71. Every time the slow timeout triggers, the CC2500 is switched on in Rx mode (lines 74-75); the fast timeout is started (line 76), and because it is clocked by the DCO, LPM0 mode is entered which leaves the DCO running (line 77).
  • Line 79. When the fast timeout expires, this timeout is stopped (line 82), the CC2500 is put to sleep (line 83) and the LPM3 mode is resumed (line 84).
  • Line 58. When the button is pressed, the board transmits 50 micro-frames, each containing a decrementing counter.

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
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, 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