-
Home
- Ezwsn: experimenting with wireless
- Lab 3: flashing leds, simple
- 3.1. a steady led
Creating a project in iar
If you want to create your own project in IAR, you need to repeat these steps:
- Connect the eZ430-RF2500 programming board to the computer and open IAR;
- Choose
Create new project in current workspace
;
- Leave Tool Chain to MSP430; as project template, choose
C>main
; click
OK
;
- Create a directory on your desktop in which you save your project;
- Go to
Project>Option
(Alt+F7) , in General Option, choose
Device=MSP430F2274
; in Debugger, choose
Driver=FET Debugger
.
For your convenience, you can download the entire
source code for the labs in this collection, organized in IAR projects. Open
source_code/iar_v4.11.lab_ezwsn.eww
and browse through the different projects in the
Workspace
panel on the left.
Running the code
- Copy the following code into IAR
.
- Compile and download the code onto the board
(Ctrl+D) .
- Let the code execute
(F5) , you should now see both LEDs on.
#include "io430.h"
int main( void ){
WDTCTL = WDTPW + WDTHOLD;P1DIR |= 0x03;
P1OUT |= 0x03;while(1);
}
Switching on both LEDs
Some keys for understanding the code:
-
Line 1 :
io430.h
contains all the macros used for translating human readable
values (e.g.
P1DIR
) into actual memory location. Right click on
io430.h
and
choose
Open "io430.h"
to see its content.
-
Line 4 : The MSP430 has a watchdog timer which resets the board if it is not reset
before it elapses. This way, if you code hangs, the board restarts and continuesfunctioning. For our simple examples, we disactivate this function by writing the
correct values into register
WDTCTL
.
-
Line 5 declares
P1.0
and
P1.1
as output pins. This is done by turning bits 0 and
1 to 1 in register
P1DIR
;
-
Line 6 sets the output state of pins
P1.0
and
P1.1
to logic 1 (physically somewhere
between 2.2V an 3.5V). This causes the LEDs, connected to those pins, tolight.
-
Line 7 loops, leaving the board running.
Energy consumption
- Comment out line 6 and run the board from the battery unit. Use the resistor
jumper and the oscilloscope to read out the default energy consumption (i.e.MSP430 running, no LEDs, no CC2500);
- Repeat this by leaving line 6. By subtracting the results, you can measure the
energy consumption of the LEDs;
- replace line 6 by
P1OUT |= 0x01
and
P1OUT |= 0x02
will leave on the
red and green LEDs only, respectively. You can now measure the consumptionof the LEDs independently.
Make sure you obtain results close to the ones presented in the following table.
no lEDs (MSP430 running) |
3.12mA |
red+green LED |
9.12-3.12=6.00mA |
red LED |
7.04-3.12=3.92mA |
green LED |
5.20-3.12=2.08mA |
Current consumed by the LEDs
Questions & Answers
if three forces F1.f2 .f3 act at a point on a Cartesian plane in the daigram .....so if the question says write down the x and y components ..... I really don't understand
hey , can you please explain oxidation reaction & redox ?
hey , can you please explain oxidation reaction and redox ?
Boitumelo
for grade 12 or grade 11?
Sibulele
advantages of electrons in a circuit
we're do you find electromagnetism past papers
Ntombifuthi
it is the force or component of the force that the surface exert on an object incontact with it and which acts perpendicular to the surface
Sihle
what is the half reaction of Potassium and chlorine
how to calculate coefficient of static friction
how to calculate static friction
Lisa
How to calculate a current
Tumelo
how to calculate the magnitude of horizontal component of the applied force
Mogano
How to calculate force
Monambi
a structure of a thermocouple used to measure inner temperature
a fixed gas of a mass is held at standard pressure temperature of 15 degrees Celsius .Calculate the temperature of the gas in Celsius if the pressure is changed to 2×10 to the power 4
How is energy being used in bonding?
a rate of change in velocity of an object whith respect to time
Khuthadzo
how can we find the moment of torque of a circular object
Kidist
Acceleration is a rate of change in velocity.
Justice
how to calculate tension by substitution
use fnet method. how many obects are being calculated ?
Khuthadzo
how to calculate acceleration and tension force
you use Fnet equals ma , newtoms second law formula
Masego
please help me with vectors in two dimensions
how to calculate normal force
Mulaudzi
Got questions? Join the online conversation and get instant answers!
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.