How do I create a high resolution timer for Netduino Plus
#1
Posted 14 September 2011 - 02:36 AM
#2
Posted 14 September 2011 - 06:31 AM
Please have a look at Chris Walker's SleepMicroseconds function.Or, does anyone have a suggestion on an approach that would allow me to create a timer with 100 microsecond resolution or better that I can have trip an interrupt when it times out?
Netduino microcontroller has hardware timer modules, but unfortunately there are no managed classes to access them in the current version of .NET Micro Framework. The resolution of system clock is ~21µs (46875 Hz), this determines the precision of all time-related functions. Also, .NET MF is not real-time system, so there is no guarantee for response times etc., and garbage collector may interrupt the application for a few milliseconds. Even if you use external timer connected to Netduino and instantiate InterruptPort, the application will not work reliably with such precision requirements - interrupt requests are queued in .NET MF, and it takes roughly hundreds of microseconds before the handlers start executing.
#3
Posted 14 September 2011 - 06:52 AM
#4
Posted 14 September 2011 - 10:48 AM
-- H.L. Mencken, "What I Believe"
#5
Posted 14 September 2011 - 11:51 AM
Instead saying "nothing is stopping you", it would be better to say "the only way to solve this"...There's also nothing stopping you from adding another microcontroller to your project that handles timing-critical stuff and communicates with your netduino e.g. using SPI. That way, you can use c# for the high-level stuff and have exact timings for the time-critical stuff.
#6
Posted 14 September 2011 - 12:28 PM
Instead saying "nothing is stopping you", it would be better to say "the only way to solve this"...
Well, what I was trying to say that you don't need to give up on the netduino completely
-- H.L. Mencken, "What I Believe"
#7
Posted 16 September 2011 - 03:00 AM
#8
Posted 22 September 2011 - 09:52 PM
#9
Posted 23 September 2011 - 02:43 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users