You probably have two problems. The first one is interference
from the WiFi signal which may be due to poor grounding/shielding
or using too low a signal at your input pin. The second is that
it's fairly dicy trying to detect a 1ms pulse with a 1ms timer...
nyquist says you need to sample at at least twice the frequency
of what you want to resolve.
So you want to use a faster timer or perhaps a Capture input.
Look at the MSP manual for some (too much) info on Capture.
For drivers, I don't know what is available in T2, but T1 has:
tos\platform\msp430\MSP430TimerC.nc
and Boomerang:
tos\platform\msp430\timer\Counter32khzC.nc
which may exist in some form in T2 as well.
As to how many interrupts you can process, it pretty much depends on
how much each int does. Off the top of my head I think the telosb runs
at 4Mhz with one or two clocks per instruction, so say two...that makes
about 2000 instructions in 1ms.
MS
André Miguel de Almeida Marrão Rodrigues wrote:
Hi
I just sent it again because is seems the first one did not appear in
the list.
André
----- Original Message ----- From: "André Miguel de Almeida Marrão
Rodrigues" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, November 21, 2007 10:15 PM
Subject: Pulse detection in T2 TMote port
Hi
I need do detect a digital 1ms width pulse in tmote port.
I have modified the TEP 109 - Binary Pin-Connected Sensor in order to
detect the rising
edge of the sinal (a square sinal with 1ms width) and that worked
perfect until the day
that I get the node with my device near a WIFI router. Somehow noise
introduced in the
circuit and there are a few false pulses.
So now I want to detected the raising edge and the failing edge (using
the TEP 109 code) and
measure the time between them, which should be arround 1ms. First
things become complicated
because I'm not sure how to get the uS timer on TMote (so I use the ms
timer...) and perhaps most importante I'm not sure
if I can process 2 interrupts (with the associated code on the driver
and on the program) in a 1ms timeframe.
The code for the driver is the one from the TEP109 (user button); my
code is:
event void Notify.notify(bool val) {
uint32_t begin;
uint32_t now;
if (val == FALSE) {
call Timer1ms.startOneShot(2); //just to count the time from the
raising edge
}
else { //so it's a falling edge
begin = call Timer1ms.gett0();
now = call Timer1ms.getNow();
if ((now - begin)< 2000 ){
.......> a true pulse was detected
Any advice or ideas are much appreciated.
Regards,
André Rodrigues
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help