/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII Counter.nc
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
/**
* Counter is incremented after every second; the result is displayed
* on LEDs.
*
* @author Sajid (dot) Hussain (at) acadiau.ca
**/
configuration Counter {
}
implementation {
components Main;
components CounterM;
components TimerC;
components LedsC;
Main.StdControl -> CounterM.StdControl;
CounterM.Timer -> TimerC.Timer[unique("Timer")];
Main.StdControl -> TimerC.StdControl;
CounterM.Leds -> LedsC.Leds;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
CounterM.nc IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
/**
* Implementation for Counter application. The clock ticks are
* counted at one second interval. The binary value of the counter
* is displayed by LEDs. The counter resets to 0 after the
* maximum value of 7.
**/
module CounterM {
provides {
interface StdControl;
}
uses {
interface Timer;
interface Leds;
}
}
implementation {
uint8_t count;
command result_t StdControl.init() {
count=0;
call Leds.init();
return SUCCESS;
}
command result_t StdControl.start() {
call Leds.redOff();
call Leds.greenOff();
call Leds.yellowOff();
return call Timer.start(TIMER_REPEAT, 1000);
}
command result_t StdControl.stop() {
return call Timer.stop();
}
result_t display(uint8_t value)
{
if (value &1) call Leds.yellowOn();
else call Leds.yellowOff();
if (value &2) call Leds.greenOn();
else call Leds.greenOff();
if (value &4) call Leds.redOn();
else call Leds.redOff();
return SUCCESS;
}
task void increment()
{
count = count + 1;
if (count > 7) count = 0;
display(count);
}
event result_t Timer.fired()
{
post increment();
return SUCCESS;
}
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
During compilation it is giving error. Toscheck is giving no error. i m
sending the errors:
Please any one knows what is wrong...please reply
[EMAIL PROTECTED] MyCounter]# make pc
compiling Counter to a pc binary
ncc -o build/pc/main.exe -g -O0 -board=micasb -pthread -target=pc -Wall
-Wshadow -DDEF_TOS_AM_GROUP=0x7d -Wnesc-all -fnesc-nido-tosnodes=1000
-fnesc-cfile=build/pc/app.c Counter.nc -lm
In file included from /root/TINYOSDIR/tinyos-1.x/tos/platform/pc/GuiMsg.h:51,
from /root/TINYOSDIR/tinyos-1.x/tos/types/dbg.h:70,
from /root/TINYOSDIR/tinyos-1.x/tos/platform/pc/hardware.h:65,
from /root/TINYOSDIR/tinyos-1.x/tos/system/tos.h:132:
/root/TINYOSDIR/tinyos-1.x/tos/types/AM.h:155: parse error before `struct'
/root/TINYOSDIR/tinyos-1.x/tos/types/AM.h:156: parse error before `struct'
/root/TINYOSDIR/tinyos-1.x/tos/types/AM.h:158: parse error before `struct'
/root/TINYOSDIR/tinyos-1.x/tos/types/AM.h: In function `TOS_MsgLength':
/root/TINYOSDIR/tinyos-1.x/tos/types/AM.h:183: parse error before `TOS_Msg'
In file included from /root/TINYOSDIR/tinyos-1.x/tos/platform/pc/hardware.h:116,
from /root/TINYOSDIR/tinyos-1.x/tos/system/tos.h:132:
/root/TINYOSDIR/tinyos-1.x/tos/platform/pc/eeprom.c: At top level:
/root/TINYOSDIR/tinyos-1.x/tos/platform/pc/eeprom.c:114: warning: declaration
of `length' shadows global declaration
/root/TINYOSDIR/tinyos-1.x/tos/types/AM.h:158: warning: location of shadowed
declaration
/root/TINYOSDIR/tinyos-1.x/tos/platform/pc/eeprom.c:144: warning: declaration
of `length' shadows global declaration
/root/TINYOSDIR/tinyos-1.x/tos/types/AM.h:158: warning: location of shadowed
declaration
make: ** [build/pc/main.exe] Error 1
Waiting for response......
Servesh Singh
---------------------------------
No need to miss a message. Get email on-the-go
with Yahoo! Mail for Mobile. Get started.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help