dbg(....) writes trace messages to the console when running TOSSIM,
I believe it is a NOOP when running on a real re-Mote.
Probably a careful reading of the doc/tutorial will help with the
other questions. However, briefly, usually nothing happens in a sensor
program that isn't fired off by an interrupt of some kind. The timer
interrupt is used to sample and send data at regular intervals. It
doesn't have much to do with radio comm but is used to start each ADC
conversion so you get data samples at (mostly) predictable intervals.
I'm not sure what you don't understand about the included code...
Basically, ADC.dataReady() is an "interrupt" handler that is called
when a sample value (that was initiated by the timer.fired()) is ready
from the Analog-Digital Converter. It does a little munging around and
then posts the dataTask(), which is something like starting a new process
to do work so the interrupt routine isn't hung up for a long time.
dataTask() formats some message header stuff and calls Send() to put
the message on the air.
MS
Hossam El-Din Hassanein wrote:
Hello all ,
I am having some problems understanding how the OscilloscopeRF works so
i need someone to give me help with these problems...
first of all , in the StdControl.init() method i dont understand what
this line means >>
dbg(DBG_BOOT, "OSCOPE initialized\n");
return SUCCESS;
Second , i don't understand the use of timer ... it is alwayz the case
that in the RF communication modules there exists timer i don't really
get the reason why ?
Third , I don't understand how this works and what is its meaning? :
------------------------------
---------------------------------------------------------------------------
task void dataTask() {
struct OscopeMsg *pack;
atomic {
pack = (struct OscopeMsg *)msg[currentMsg].data;
packetReadingNumber = 0;
pack->lastSampleNumber = readingNumber;
}
pack->channel = 1;
pack->sourceMoteID = TOS_LOCAL_ADDRESS;
/* Try to send the packet. Note that this will return
* failure immediately if the packet could not be queued for
* transmission.
*/
if (call DataMsg.send(TOS_BCAST_ADDR, sizeof(struct OscopeMsg),
&msg[currentMsg]))
{
atomic {
currentMsg ^= 0x1;
}
call Leds.yellowToggle();
}
}
async event result_t ADC.dataReady(uint16_t data) {
struct OscopeMsg *pack;
atomic {
pack = (struct OscopeMsg *)msg[currentMsg].data;
pack->data[packetReadingNumber++] = data;
readingNumber++;
dbg(DBG_USR1, "data_event\n");
if (packetReadingNumber == BUFFER_SIZE) {
post dataTask();
}
}
if (data > 0x0300)
call Leds.redOn();
else
call Leds.redOff();
return SUCCESS;
}
-------------------------------------------------------------------------------------
thanks for reading my post , and please help .
Hossam.
------------------------------------------------------------------------
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help