|
Page 1 of 1
|
[ 6 posts ] |
|
| Author |
Message |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 509 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Feature Request: timing.
Would it be possible to be able to time in microseconds and nanoseconds? That would be very, very, very useful.
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Mon May 14, 2012 5:49 pm |
|
 |
|
Dennis Mabrey
Rookie
Joined: Mon May 14, 2012 3:24 pm Posts: 43
|
 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).
|
| Mon May 14, 2012 6:19 pm |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 509 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Re: Feature Request: timing.
Well, I think that the HD44780 interface requires pulses nanoseconds apart, but I might've read it wrong.
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Mon May 14, 2012 11:43 pm |
|
 |
|
tfriez
Site Admin
Joined: Wed Jan 24, 2007 10:42 am Posts: 537
|
 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.
_________________Timothy Friez ROBOTC Developer - SW Engineer tfriez@robotc.net
|
| Tue May 15, 2012 9:20 am |
|
 |
|
mattallen37
Expert
Joined: Thu Sep 29, 2011 11:09 pm Posts: 146 Location: Michigan USA
|
 Re: Feature Request: timing.
The Uno uses a 16MHz clock, so the precision is limited to 0.0000000625 seconds with no pre-scaler.
_________________ Matt
|
| Tue May 15, 2012 10:27 am |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 509 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 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.
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Tue May 15, 2012 11:45 am |
|
|
|
Page 1 of 1
|
[ 6 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 2 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|