I did a port of the arduino millis() and micros() library functions that uses a 16-bit TMR along with a CCP module to produce msec and usec delays with 1us resolution. See the wiki page millis() and micros() timer routines
These are improved versions that do not suffer from the same inaccuracies/lack of resolution as the original arduino functions.
The millimicros.bas module also shows two different methods for safely accessing variables shared between an ISR and the main context.
arduino millis() and micros() functions
Moderators: David Barker, Jerry Messina
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: arduino millis() and micros() functions
Thank you Jerry for sharing and the continue support here..