Well it depends on what you mean by better. If it is working for you now with no issues, I would say you are done. If you want to start using the uP for more stuff, and timing is an issue, use an interrupt or DT_INT elasped timer to drive the ticks.
Or for a somewhat middle of the road approach, you could set up a timer to free run, then poll that timers flag (ie: PIRx.x) in your main. when its set, gosub to update a counter. From there, if the count=time to take reading, take the reading and reset the counter. You can set this up with little trouble and it will be as accurate as the time between polling the flag. depending on your uP, using pre/post scalers and PR if available, it is not too hard to do.
IMHO, adding external things does not make this easier at all.




Bookmarks