Multiple time periods in SPIN
AGCB
Posts: 327
in Propeller 1
Is there an easy way to do different tasks at different rates? I mean I want to display time info from a RTC every second but don't need to update room temperature but every few minutes. A few other things may need 1 minute updates or even only every 10 minutes etc.
I have a second counter (don't confuse the ms name with milliseconds) that I have used like this
I've also used IF statements with the RTC like this
There must be an easier way!! I hope to learn from the experts.
Thanks
Aaron
I have a second counter (don't confuse the ms name with milliseconds) that I have used like this
if (ms==600) OR (ms==1200) OR (ms==1800) OR (ms==2400) OR (ms==3000) OR (ms==3600){ } OR (ms==4200) OR (ms==4800) OR (ms==5400) OR (ms==6000) OR (ms==7198) gust:=0 ' every 10 minutes 'counter counts to 7200 and then resets to 0But that gets long to write.
I've also used IF statements with the RTC like this
IF (timbuf[hours]==04) AND (timbuf[minutes]==03) AND (timbuf[seconds]<10) MaxWind := 0 'reset maxWind and HI/LO at 4:03 AM each dayBut some times those happen multiple times or miss the intended time if the RTC is in its own COG. Results in needing flags.
There must be an easier way!! I hope to learn from the experts.
Thanks
Aaron
Comments
I knew you guys would come through!
Aaron