
Originally Posted by
lilimike
Some days I feel dumber than others and today is one of those!
All I really need is to have a counter that counts the minutes up to 720 and then cycle to 0 and start over endlessly. I don't need an interupt as I can test compare by branching from the main loop (in one minute I have plenty of time to test) Accuracy is not really important + or - 10 minutes over 720 is ok. I am already using timer0 so I guess I need to use timer1 or timer2.
Mike
Hi Mike,
Welcome to My World!
Code:
counter var byte
minutes var word
clear ' zero variables at start
loop:
PortB = %00000000
TRISB = %00000000
counter = counter + 1
Pause 1000
If counter >= 60 then minutes = minutes + 1 : counter = 0
if minutes >= 720 then gosub action
goto loop
Action:
minutes = 0
Toggle PortB.1 ' change this to do what you need done
return
A great clock this will not be, it does (should do) what you asked, you may need to juggle the numbers if you have a bunch of code to stuff in.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks