Hi Manjunath,

Despite the ret variable being defined as 32-bit unsigned integer, the 
compiler might do the calculations per default in 16-bit, thus getting 
an incorrect result. Can you try to add the letter "L" behind the 
numeric constants to force the compiler to do the calculations in 
32-bits and see whether this works?

Cheers,
Urs

On 10/23/10 9:52 AM, Manjunath Doddavenkatappa wrote:
>
> The following is a simple program which intend to make LED to blink once
> in every 5.4 minutes.
>
> But the Timer fires very quickly, at least twice in every one second!!!. I
> am I missing something very basic ???
>
> As defined in Timer.nc, the input to StartPeriodic and OneShot is uint32.
> I am using 2.1.1 and Telosb motes.
>
> module BlinkC ()
> {
>     uses interface Timer<TMilli>  as Timer0;
>     uses interface Leds;
>     uses interface Boot;
> }
>
> implementation
> {
>
>     uint32_t get_wait_time()
>     {
>       uint32_t ret;
>       ret = (100-18)*4000;
>       return(ret);
>     }
>
>     event void Boot.booted()
>     {
>       uint32_t wait_time;
>
>       wait_time = get_wait_time();
>       call Timer0.startPeriodic(wait_time);
>     }
>
>     event void Timer0.fired()
>     {
>       dbg("BlinkC", "Timer 0 fired @ %s.\n", sim_time_string());
>       call Leds.led2Toggle();
>     }
>
> }
>
>
>
> Manjunath D
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to