![]() |
Forum Index : Microcontroller and PC projects : DM multiple setticks
Author | Message | ||||
Blackened![]() Regular Member ![]() Joined: 11/08/2012 Location: AustraliaPosts: 66 |
Hey all, I'm planning to use the following code to use multiple DS18b20 1wire sensors. My main loop will get the most recent temperature reading from variables that will be continuously updated via the settick interrupt. My question is, can the timing (800ms) between the two setticks "drift" if the program runs for an extended period? Is there anything that I could conceivably do within the main loop that might delay either interrupt and put them out of sync? This seems like it should work to me but I have a doubt lol settick 900,convert,1 'instruct all sensors to begin conversion at highest resolution pause 800 settick 900,read_temp,2 'read all sensor data and store in variables Thanks everyone ![]() |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6269 |
They both get their timing from the same master clock so they should keep step. Another way would be for the first sub to set a timer for the second one (the one that reads. The second sub would then cancel the second timer which gets re-initialised from the first sub next time around. That lets you change the main timing loop or the delay between the two without having to worry about setting multiple timers. Jim VK7JH MMedit |
||||
Blackened![]() Regular Member ![]() Joined: 11/08/2012 Location: AustraliaPosts: 66 |
Thanks Jim, ![]() Glad I wasn't heading in totally the wrong direction lol. I rarely write programs, only when required for a new project so I never become fluent unfortunately. I decided to do it this way because I won't need to alter the accuracy/conversion time for the duration of the program. At this point I have no need for the other timer interrupts either, but that could change. Peter |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |