ROBOTC.net forums
http://www.robotc.net/forums/

Feature Request: timing.
http://www.robotc.net/forums/viewtopic.php?f=62&t=4537
Page 1 of 1

Author:  NeXT-Generation [ Mon May 14, 2012 5:49 pm ]
Post subject:  Feature Request: timing.

Would it be possible to be able to time in microseconds and nanoseconds? That would be very, very, very useful.

Author:  Dennis Mabrey [ Mon May 14, 2012 6:19 pm ]
Post subject:  Re: Feature Request: timing.

Something like the pulseIn() function would be very useful for ultrasonic sensors. I am not sure what you would want nanosecond timing for but I am aware that some people have been able to make some degree of timers using multiple NOP calls (something like #define nop() __asm__ __volatile__("nop"))

Each nop call is one clock cycle which would be about 62.5 ns on the 328p Uno's (I think).

Author:  NeXT-Generation [ Mon May 14, 2012 11:43 pm ]
Post subject:  Re: Feature Request: timing.

Well, I think that the HD44780 interface requires pulses nanoseconds apart, but I might've read it wrong.

Author:  tfriez [ Tue May 15, 2012 9:20 am ]
Post subject:  Re: Feature Request: timing.

ROBOTC uses an overflow system to detect when 1ms has elapsed and that's what runs the ROBOTC clock. I'll look into maybe having a user timer with microsecond precision, but I have a feeling this might be a significant change.

We did recently add (but haven't advertised due to still testing) a "Sleep(nMsec)" function - it should work in the BETA build you're using... this will at least allow you to sleep/delay for a certain number of microseconds vs. the wait1Msec(mSec) commands in milliseconds.

Author:  mattallen37 [ Tue May 15, 2012 10:27 am ]
Post subject:  Re: Feature Request: timing.

The Uno uses a 16MHz clock, so the precision is limited to 0.0000000625 seconds with no pre-scaler.

Author:  NeXT-Generation [ Tue May 15, 2012 11:45 am ]
Post subject:  Re: Feature Request: timing.

Okay, so no nanoseconds. I think I read the datasheet wrong anyway, because the 3Pi uses the HD44780 interface with 16Mhz clock.

How long does it take the 328P to wake up? That could interfere with the timing, if it's sleeping and then takes extra time waking.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/