Forum Rule: Always post complete source code & details to reproduce any issue!
-
Accurate Timestamp On T4.0
I'm testing out TimeLib.h for getting an accurate (us) timestamp on sensor readings. I'm able to run the TimeTeensy3 example just fine, but not seeing how I use TimeLib to get a us-level timestamp. I suppose I could use micro() somehow and try to line that up with every one-second interval, but seems like there's probably an easier way.
P.S. I searched the forum and didn't see this explicitly. Apologize if I missed this if it's already been addressed.
-
Update:
Got a 1sec RTC interrupt timer working (derived from code posted in the forum). So I just need to add my own uSec sub-timer. But am still surprised there's not a lib out there that allows us to easily (precisely) timestamp an incoming sensor reading. If someone has seen one, I'd appreciate a link!
-
Senior Member+
although most of the T4 RTC example sketches just return seconds. The T4 RTC registers (2 32-bit registers) actually count 32768 ticks, so you could get sub-second values at a precision of 1/32768. of course if you don't need time-of-day values, micros() will give you microsecond resolution timestamps.
-
manitou, thanks. Yes, I'm aware of micros(), but need it relative to time of day. I searched for RTC registers on the forum and found this link:
https://forum.pjrc.com/threads/53372...=RTC+registers
Thinking it has some really good ideas, but will take me awhile to digest!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules