Dear All,
are you availabe now ?could you give me a favor? I have written a module
which can response the external interrupe1.The code is following
[code]
module HPLPulse {
provides interface StdControl;
uses
{
interface Leds;
}
}
implementation
{
uint8_t pulseValue;//
command result_t StdControl.init() {
atomic {
PULSE_INT_MODE(0);// the downing edge
PULSE_INT_DISABLE();
pulseValue = 0;
}
call Leds.init();
return SUCCESS;
}
command result_t StdControl.start() {
PULSE_INT_ENABLE();
return SUCCESS;
}
command result_t StdControl.stop() {
return SUCCESS;
}
TOSH_INTERRUPT(SIG_INTERRUPT1) {
atomic{
pulseValue++;//脉冲数加1
if (pulseValue & 1) call Leds.redOn();
else call Leds.redOff();
if (pulseValue & 2) call Leds.yellowOn();
else call Leds.yellowOff();
if (pulseValue & 4) call Leds.greenOn();
else call Leds.greenOff();
}
}
}
In the code I have set a variable as pulseValue,when the interrupt comming
,the vairable pulseValue will increnments 1,and we can notice that the leds
would on or off.In my experiment,when I run the application, the result of
leds will be not consistent with my expectation.
But when i use dbg tools to debug the code step by step, the code is
right.could you give me some comments?
thanks in advance
ps. I use the tinyos 1.15 version .
Best Regards
Sophia Su
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help