Imagine the following situation (I'm using Shimmer and tinyos 2.x):
I want to do an continous monitoring of the Accelerometer. I want to
sample one of the ADC-Channels connected to the accelerometer at a
frequency of 250 Hz (t_sample = 4ms) What I'm doing now is using a timer
with a period time of 4 (ms). When the Timer is firing, the function
read (connected to the Component "AdcReadClientC", configured with
interface "AdcConfigure") is called. The ADC is sampling a single value,
which is stored in a temporary array.
After 16 values are collected (a counter in the readDone function is
used), the values should be broadcasted via Radio. Therefor I'm using
the interfaces Packet, AMPacket, AMSend and SplitControl. So AMSend is
called from the Read-function every 16th sample.
I'm using a busy flag for the broadcast-process and another busy flag
for the adc. To the programm looks something like that (pseudocode)
Timer.fired {
if ADCBusyFlag not busy
ADCBusyFlag is set to busy;
call Read
else
toggle Red LED;
}
Read.done {
collect values;
if number of values = 16
if RadioBusyFlag not busy
create the message
call AMSend.send and set RadioBusyFlag to busy
clear ADCFlag
else
toggle Yellow LED
}
AMSend.sendDone{
clear RadioBusyFlag
}
(I can give further explanations or the real code, if my problem is not
understood well.)
Now the problem: When I have one single note, that is Sampling and
Sending to a BaseStation, everything works fine and none of the LEDs are
toggling. When I'm using to shimmers, both Sampling a single ADC, the
red LED are both toggling sometimes, which means, that processing
couldn't be finished until next call of Read and some Samples are
getting lost. Can someone say me, what the problem is, here?
Am I using the correct functions for ADC? Are threre better ones for
continous sampling?
Another question: Which interfaces should be used, when I want to sample
all three channels of the ADC continously?
Thanks for help
Jens Burmeister
--
Jens Burmeister
KTH Royal Institute of Technology
School of Technology and Health (STH)
Email: [email protected]
Address: Marinens väg 30
136 40 Haninge, Sweden
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help