<< Chapter < Page | Chapter >> Page > |
If you want to create your own project in IAR, you need to repeat these steps:
Create new project in current workspace
;C>main
; click
OK
;Project>Option
(Alt+F7) , in General Option, choose
Device=MSP430F2274
; in Debugger, choose
Driver=FET Debugger
.source_code/iar_v4.11.lab_ezwsn.eww
and browse through the different projects in the
Workspace
panel on the left.
source_code/iar_v4.11/lab_ezwsn.eww
with IAR. The project corresponding to this section is called
led_steady
. .#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:
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.WDTCTL
.P1.0
and
P1.1
as output pins. This is done by turning bits 0 and
1 to 1 in register
P1DIR
;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.
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 |
Notification Switch
Would you like to follow the 'Ezwsn: experimenting with wireless sensor networks using the ez430-rf2500' conversation and receive update notifications?