Hi,

I solved a part of this problem myself.
I measured the clock speed and it came out to be 7372800, so I'm assuming 
92160Hz is correct.  And I confirmed that 1024 ms is equivalent to 1sec.

I havn't figure out how to get 64 bit LocalTime yet.
I made an interface my self thats similar to LocalTime, just returns in 
uint64_t form instead. I copied and modified LocalTimeMicroC.
I changed TransformCounterC part to
components new TransformCounterC(TMicro, uint64_t, TMicro, uint16_t, 0, 
uint64_t);
I can compile with this source, but the return value of get() always becomes 0.

Any suggestions?

Best,
John
 Hi, 
 
 thank you for your reply.
 I got 3 questions.
 1. Isn't 7.37MHz / 8 = 921250Hz, not 921600Hz.  Which one is correct??
 2. I did "call Timer.startPeriodic(1024);" because according to TEP102, it 
says that 1024 milli sec equals to 1 sec.  Am I doing right if I want clock to 
fire every 1 sec using Atmega1281?
 3. If my calculation is correct, microsec overflows pretty quickly (about 
40min?).  Is there any way that I can make it work longer?
 
 Best,
 John
 
  John:
 
 On the iris platform, as it is configured by default, LocalTimeMicroC
 provides a 921600Hz clock. What you're seeing is correct.
 
 This is because the MCU clock source is a baud friendly 7.37MHz
 crystal, and the prescaler of Timer1 is set to 8. It is possible to
 have a 1MHz clock, however, you will need to use the internal
 oscillator as the MCU clock source instead. See TEP 102 Appendix C
 (mica family) and the ATMega1281 datasheet for details.
 
 Janos
 
 2009/11/7  :
 > Hi,
 >
 > I am using Iris mote and TinyOS-2.x, and trying to get local time in micro
 > seconds.
 > I put my code at the end of this mail, and my out put looks something like
 > this:
 > 1024 986787
 > 2048 1908532
 > 3072 2830276
 > 4096 3752021
 > ...
 > I looked through TEP102, and it says "one second contains 1024 binary
 > milliseconds, 32768 32kHz ticks, or 1048576 microseconds", but it seems that
 > in my case, microseconds only increases about 921745 for each 1024ms.
 > Is this what I'm supposed to get? or I'm doing something wrong?
 >
 > Also, Is there any way to get microsec in uint64_t??
 >
 > Best regards,
 > John
 >
 >
 >
 > __PrintTimeAppC.nc__
 > configuration PrintTimeAppC{
 > }
 > implementation {
 >   components MainC, PrintTimeC;
 >   components LocalTimeMicroC;
 >   components LocalTimeMilliC;
 >   components new TimerMilliC() as Timer;
 >   PrintTimeC.Boot -> MainC;
 >   PrintTimeC.LocalMicro -> LocalTimeMicroC;
 >   PrintTimeC.LocalTime -> LocalTimeMilliC;
 >   PrintTimeC.Timer -> Timer;
 > }
 >
 > __PrintTimeC.nc__
 > #include "printf.h"
 > #include "Timer.h"
 > #include "MicaTimer.h"
 >
 > module PrintTimeC {
 >     uses {
 >         interface Boot;
 >         interface LocalTime as LocalMicro;
 >         interface LocalTime as LocalTime;
 >         interface Timer as Timer;
 >     }
 > }
 > implementation {
 >     event void Boot.booted() {
 >         call Timer.startPeriodic(1024);
 >     }
 >     event void Timer.fired() {
 >         printf("%ld %ld\n", call LocalTime.get(), call LocalMicro.get());
 >         printfflush();
 >     }
 > }
 >
 > __Makefile__
 > COMPONENT=PrintTimeAppC
 > CFLAGS += -I$(TOSDIR)/lib/printf
 > CFLAGS += -I$(TOSDIR)/lib/timer
 > CFLAGS += -I$(TOSDIR)/platforms/iris
 > include $(MAKERULES)
 >
 >
 > ________________________________
 > GyaO! - Anime, Dramas, Movies, and Music videos [FREE]
 >
 > _______________________________________________
 > Tinyos-help mailing list
 > [email protected]
 > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
 >
 
   
      

---------------------------------
GyaO! - Anime, Dramas, Movies, and Music videos [FREE]
 _______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
 

 
---------------------------------
GyaO! - Anime, Dramas, Movies, and Music videos [FREE]
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to