Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:24 07 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : DM multiple setticks

Author Message
Blackened

Regular Member

Joined: 11/08/2012
Location: Australia
Posts: 66
Posted: 02:39pm 12 Oct 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 6269
Posted: 05:35pm 12 Oct 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 66
Posted: 01:41pm 13 Oct 2014
Copy link to clipboard 
Print this post

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
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025