Delay microseconds
#1
Posted 02 February 2012 - 11:03 PM
#2
Posted 03 February 2012 - 12:11 AM
private void DelayMicroseconds(int microseconds) { long delayTime = microseconds * 10; long delayStart = Utility.GetMachineTime().Ticks; while ((Utility.GetMachineTime().Ticks - delayStart) < delayTime) ; }
#3
Posted 03 February 2012 - 07:17 AM
#4
Posted 03 February 2012 - 09:18 AM
temp++;Just an example...I don't know how much it takes.
Cheers
#5
Posted 19 April 2012 - 01:19 AM
Please note due to Netduino timer resolution the code works in multiples of ~21µs.
Any idea what the Go timer resolution is?
#6
Posted 19 April 2012 - 06:08 AM
1 µsAny idea what the Go timer resolution is?
#7
Posted 19 April 2012 - 07:55 PM
1 µs
What about the hardware interrupts? I though they were 1 µs as well.
http://jarrodsinclair.wordpress.com//
#8
Posted 24 August 2012 - 07:28 PM
Here's a function that i wrote. I find it quite accurate: (loosely based on the functions mentioned above)
private static void delayMicroseconds(int microseconds) { for (int temp = 0; temp < ((microseconds - 208)/61); temp++); }
It works in ~65us wide steps, and it's minimum is about 240us.
have fun,
Attached Files
#9
Posted 28 August 2012 - 10:49 PM
Hi,
Here's a function that i wrote. I find it quite accurate: (loosely based on the functions mentioned above)
private static void delayMicroseconds(int microseconds) { for (int temp = 0; temp < ((microseconds - 208)/61); temp++); }
It works in ~65us wide steps, and it's minimum is about 240us.
have fun,
Nice idea. I will play with this when my scope comes in the mail.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users