I don't beleive the on board version of printf implements floating point. You are running on an extremely resource constrained platform (motes tend to be resource constrained, it is why they are such low power).
However, you seem to be treating it like a "normal" computer. It's embedded mon. Time to change the mindset. more below... On Fri, Nov 1, 2013 at 8:00 AM, João Amaral <[email protected]> wrote: > Hello sir, > > Thank you very much. I had no idea the Timer interface had more commands, > It is not cool to go to the list with questions you could answer yourself or should be able to answer yourself. These are very simple questions you are asking. First, work through the tutorials. See docs.tinyos.net. Second get used to searching the code base. For example, interfaces such at Timer are pretty well documented when they were first written. How would you find where the Timer interface is documented? First, either via the tutorial or via inspection of the Blink application, you would see something like "uses interface Timer<TMilli> as Timer0;" That tells you to look for the file Timer.nc which defines what the interface looks like. here is how i find things. 1) looking for a file find . -iname "*timer.nc*" and 2) when looking for places that use say __nesc_enable_interrupt, I use: grep -nHiR -e nesc_enable_interrupt . that is a dot at the end and I run both of those commands from the command line. (Note: I switched from Windows/Cygwin years ago because it was buggy and obnoxious. I run on Debian based hosting platforms and am one of the main msp430 maintainers for TinyOS.) You should also read Phil Levis' and David Gay's book about programming TinyOS. There are also many good tutuorials out on the net, do a google search for "Getting started with tinyos". If you want more help, you need to put more effort in at answering your own simple questions. more below. > I had only seen references to startPeriodic() and startOneShot(). > I managed to make it work. However, when I try to print floating numbers > using blip_print.h, it doesn’t work: > > TBase: 1800 > TNow: 11046 > deltaTime: 9246 > Elapsed seconds (dec): %f. > Elapsed seconds (bin): %f. > > why on earth are you even thinking about floating point. The mcu doesn't have native support and most likely is a 16 bit machine so is using 16 bit and 32 bit integer arithmetic. Converting to floating point is very expensive and printf doesn't support it. It is a bad decision, which is why I said you need to develop a different mindset when programming embedded systems. > This is the code: > > if(counter == 10) { > uint32_t aux = call TimerMain.getNow(); > deltaTime = aux - TBase; > printf("TBase: %ld\n", TBase); > printf("TNow: %ld\n", aux); > printf("deltaTime: %ld\n", deltaTime); > > printf("Elapsed seconds (dec): %f.\n",(deltaTime/1000.0)); > > printf("Elapsed seconds (bin): %f.", (deltaTime/1024.0)); > > > Is it not possible to print floats and doubles with printf? > > I also didn’t start the Timer using startPeriodic or startOneShot and I > have a blank implementation of fired event. Should I start the timer > explicitly? > > Best regards. > João Amaral > > >
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
