I'm currently trying to get system time from Mica mote.
But I'm only getting always 0 as time return value. How can I get system time value?
Here is the code for getting system time and its output by running java net.tinyos.tools.Listen. And I'm using original Mica mote.
-------------- output --------------------------------------------------
7E 00 64 7D 08 00 00 00 00 00 00 00 00
7E 00 64 7D 08 00 00 00 00 00 00 00 00
7E 00 64 7D 08 00 00 00 00 00 00 00 00
7E 00 64 7D 08 00 00 00 00 00 00 00 00
7E 00 64 7D 08 00 00 00 00 00 00 00 00
7E 00 64 7D 08 00 00 00 00 00 00 00 00
7E 00 64 7D 08 00 00 00 00 00 00 00 00
7E 00 64 7D 08 00 00 00 00 00 00 00 00
7E 00 64 7D 08 00 00 00 00 00 00 00 00
7E 00 64 7D 08 00 00 00 00 00 00 00 00
7E 00 64 7D 08 00 00 00 00 00 00 00 00
-------------------- configuration -------------------------------------------
configuration TimePut {
}
implementation {
components Main, TimePutM, TimerC, SimpleTime/*LogicalTime*/, UARTComm as Comm, LedsC;
Main.StdControl -> TimePutM;
Main.StdControl -> TimerC;
TimePutM.CommControl -> Comm;
TimePutM.SendMsg -> Comm.SendMsg[AM_TIMEPUT];
TimePutM.Leds -> LedsC;
TimePutM.Time -> SimpleTime.Time;//LogicalTime.Time;
TimePutM.Timer -> TimerC.Timer[unique("Timer")];
}
----------------- module ----------------------------------------------------------
includes TosTime;
module TimePutM {
provides {
interface StdControl;
}
uses {
interface StdControl as CommControl;
interface Time;
interface Timer;
interface Leds;
interface SendMsg;
}
}
implementation {
TOS_Msg tMsg;
tos_time_t currentTime;
task void dataTask() {
struct TimeMsg *dataMsg;
dataMsg = (struct TimeMsg *)tMsg.data;
currentTime = call Time.get();
dataMsg->lowtime = currentTime.low32;
dataMsg->hightime = currentTime.high32;
//dataMsg->lowtime = call Time.getLow32();
//dataMsg->hightime = call Time.getHigh32();
//dbg(DBG_USR1, "Current Time is %i, %i\n", high, low);
if(call SendMsg.send(TOS_UART_ADDR, sizeof(struct TimeMsg), &tMsg)) {
call Leds.greenToggle();
}
}
command result_t StdControl.init() {
dbg(DBG_USR1, "initialized!!\n");
call Leds.init();
call CommControl.init();
return SUCCESS;
}
command result_t StdControl.start() {
call CommControl.start();
return call Timer.start(TIMER_REPEAT, 2048);
}
command result_t StdControl.stop() {
call CommControl.stop();
return call Timer.stop();
}
event result_t Timer.fired() {
post dataTask();
return SUCCESS;
}
event result_t SendMsg.sendDone(TOS_MsgPtr pMsg, result_t success) {
call Leds.redToggle();
return SUCCESS;
}
}
_______________________________________________ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help