[Tinyos-help] Pulse detection in T2 TMote port

André Miguel de Almeida Marrão Rodrigues andremiguelrodrigues at gmail.com
Wed Nov 21 14:15:20 PST 2007


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




More information about the Tinyos-help mailing list