Hi Michael,

Thank you so much for your response!

As you mentioned, I have set up PE5 as an input pin using the commands -
cbi(PORTE,5);
and cbi(DDRE,5). Interrupts have been enabled using sei() and sbi(EIMSK,5).
I am guessing I have done those things correctly. Also, PE5 is a general I/O
port. Is there any extra step that I should be doing to make sure that PE5
is now an external interrupt?

I still have some questions -

   1. How do I know whether the board's light sensor power control is also
   trying to use the pin? As far as my code goes, it's standalone and it's
   doesn't use the light sensor power control. Put another way, how do I ensure
   that PE5 is not being used by anything else but my application?
   2. I have been referring to the sections on Interrupts, I/O ports and
   External interrupts in the ATMEGA manual. Could you please explain what you
   mean by peripheral interrupts? How do I enable these peripheral interrupts?
   3. In the code that you sent, the HPL interface is being used to write
   and read to I/O ports. At the moment, I am not using any such interface. Is
   it necessary to use such an interface to write to an I/O port. Shouldn't the
   "cbi" and "sbi" commands take care of that? This has been one of the biggest
   points of contention for me.
   4. Is the Timer still active when the system is in deep sleep mode?

I know this is a simple enough problem, but it's been evading me over a
week! :(

Help!
- Suresh

On Fri, Jan 1, 2010 at 3:48 PM, MIchael Schippling <[email protected]>wrote:

> I'm a little lazy so I don't want to read through all your code, but...
>
> First make sure you have set the PE5 pin as an input with interrupt
> enabled, and that nothing...say the micasb board's light sensor
> power control...is also trying to use that pin. And check that those
> peripheral interrupts are enabled elsewhere if necessary, see
> the relevant ATMEGA manual sections.
>
> Second it looks at first blush that your interrupt routine is correct,
> but compare it to other examples by searching for TOSH_SIGNAL
> and TOSH_INTERRUPT. Also I'm not sure why you have the
> comment and code "// disable interrupts" at the end as I would think
> that you might need to re-enable them.
>
> Third I have a working interrupt handler for the timer in:
>   http://www.etantdonnes.com/Motes/AVR128timers.zip
> which might have some exemplar value.
>
> MS
>
>
> Suresh Mathew wrote:
>
>> Hi,
>>
>> Due to certain constraints, my project is forced to work on TinyOS1.1. My
>> aim is to wake-up the main micro-controller based on an external interrupt.
>> PortE's 5th pin is being used as the external interrupt. To know if the code
>> is working, I have setup the code in such a way that - each time the
>> external interrupt is generated, the yellow and green LEDs are supposed to
>> toggle. Also, I have included a timer (ONE_SHOT) to the system which makes
>> sure that once the timer fires, the LEDs toggle  5 seconds later.
>>
>> The external interrupt is level triggered; it has been configured such
>> that if it's logic 0, then the interrupt is generated. Else if it's a logic
>> 1, then no interrupt generated. At present, the external interrupt is not
>> being detected. The analog value of the voltage being fed into the circuit
>> is 3V (VCC for the ATMEGA128 uC is 3.3V). Could you please tell me whether
>> there's anything wrong with the code? Am I missing some configuration? How
>> do I know whether PORTE5 is no longer a general I/O pin but an external
>> interrupt pin?
>>
>> I have attached all of the necessary files.
>>
>> Thanks,
>> Suresh
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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

Reply via email to