On Thursday 19 April 2007 09:45, Firat TARAKTAS wrote: > Hi Steve, > > I am mailing you according to statement below (Timer<TMilli> components > uses Timer A). Do you inform me about how to make Timer to use TimerB > instead of Timer A. Thanks for your help.
I was wrong. In tos2 on msp430, Timer<TMilli> components *do* use Timer B. You can see the linkages in the msp430's configuration for AlarmMilli32C. Sorry; we were working on a project recently where we didn't have a 32kHz crystal and so changed the code to run the virtual timer off of Timer A. Best, Steve > > Firat TARAKTAS > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Steve > McKown Sent: Thursday, April 19, 2007 5:37 PM > To: [email protected] > Subject: Re: [Tinyos-help] Simple question on Timer<TMilli> > > Hi, > > On Thursday 19 April 2007 05:53, Muhammad Azhar wrote: > > Hi all, > > I apologise if this is a rather basic question, but to set a timer > > to fire exactly 1s periodically (using Timer<TMilli>), do I input > > startPeriodic(1000) or startPeriodic(1024)? 'Coz all the while, I've > > always used the former, but I realised that it's never 1 sec, always > > faster than that. A colleague told me that using 1024 would make the > > timer fire every 1 sec, but didn't explain why. Thus, I'd like to > > clarify with you guys. How exactly does the 1024 convert to 1s? What > > if I'd like a timer of 1min then? Many thanks for your help. > > On the msp430 platforms, the millisecond virtual timer servicing > Timer<TMilli> components uses Timer A. Timer A is configured to use SMCLK, > which is set to DCO/4. The DCO is calibrated to 4*2^20 Hz, so Timer A's > "1MHz" timer is in fact 2^20 Hz. Because the conversion from microseconds > to milliseconds in the timer code effectively uses a 10-bit shift, 1 second > is 2^10 ticks, or 1024. So, 1024 ticks/sec * 60 secs/min = 61440 > ticks/min. > > In case you're wondering why it's set up this way: converting between > powers of 2 needs only fast bit shifts. Far more efficient than, say, > dividing by 1000. > > Cheers, > Steve > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > > > !DSPAM:462792d3221931902076913! _______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
