I added following lines to boot.booted():

        call IO.makeInput();
        call IO.set();

        call Interrupt.disable();
        call Interrupt.clear();
        call Interrupt.edge(TRUE);
        call Interrupt.enable();

It seems that problem was that i didn't set the PortE4.
Now it works fine - interrupt is triggered when I connect wire from Int4 to Gnd. Without IO.set() led toggles all the time when loose wire is connected to Int4.

I think I actually have to create a "driver" similar to Sensor Driver Example 2 (http://tinyos.cvs.sourceforge.net/*checkout*/tinyos/tinyos-2.x/doc/html/tep109.html ) I access directly to HplAtm128InterruptC. It seems from that example, that I should use GpioInterrupt interface instead.


Andres Vahter



On 22.07.2009, at 23:36, Michael Schippling wrote:

You'll have to look in the controller specs to see if there are
pullups on PortE, and that in-fact you're using the right pin.

I just looked at my interrupt code. I did it brute force with
the TOS defines that are probably also hidden in HplAtm128GeneralIOC
(which I should try to use this time around in order to increase
my confusion level). What occurred to me is that you probably
have to reset the interrupt pin in your service routine or it
will just keep firing....

There is code with portE4 made as input:
------------TestAppNodeC.nc------------------------------
-----------------------------------------------------------
configuration TestAppNodeC {}
implementation {
components TestNodeC, MainC, LedsC;
components HplAtm128InterruptC; //iris doesn't have GpioInterruptC
components HplAtm128GeneralIOC;
TestNodeC.Boot -> MainC;
TestNodeC.Leds -> LedsC;
TestNodeC.Interrupt -> HplAtm128InterruptC.Int4;
TestNodeC.IO -> HplAtm128GeneralIOC.PortE4;
}
------------TestNodeC.nc------------------------------
-----------------------------------------------------------
module TestNodeC {
uses interface Boot;
uses interface Leds;
uses interface HplAtm128Interrupt as Interrupt;
uses interface GeneralIO as IO;
}
implementation {
event void Boot.booted() {
call IO.makeInput();
        call IO.set();
        call Interrupt.disable();
        call Interrupt.clear();
        call Interrupt.edge(TRUE);

call Interrupt.enable();
}
async event void Interrupt.fired(){
call Leds.led0Toggle();
}
.....................

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to