Maximum time delay of PICAXE-08 ?

Mike.

Member
Hello friends I want to make a timer circuit to control my motor pump.
So , I just want to know the maximum time delay of PICAXE-08 chip provides.

Can this chip gives 8hr delay.. !

eg : The pump will run after 8hr(delay)..

Thanks in advance..
 

BeanieBots

Moderator
It is possible to make timers exceed many YEARS if you want to.

For example:

For w0 = 0 to 65535
Pause 1000
Next w0

would give a delay of just over 18 hours.
 

BeanieBots

Moderator
A few milliamps but you can do things to make it much lower such as sleep or underclock. This has been covered in great depth before, maybe someone can find it and post a link.
 

manuka

Senior Member
Raw "SLEEP" based timing is usually only good to ~a minute an hour, & may wander (especially if temperature varies) with errors accumulating. If you really need a consistent 8 hour delay perhaps use a DS1307 clock chip, hack into a cheap digital clock or even use the sun as a noon reference point. Further details on the motor pump (assumed mains) would clarify things!
 

lamxe

Senior Member
It is possible to make timers exceed many YEARS if you want to.

For example:

For w0 = 0 to 65535
Pause 1000
Next w0

would give a delay of just over 18 hours.
Dear Sir BeaniebBolt and All
For to learn more please help me by give other code
for month and year with noted if possible . Many thank you
 

StefanST

New Member
Code:
; wait for years ,days, hours

; if you dont want constants, use #symbol instead:
#DEFINE years 1
#DEFINE days  10
#DEFINE hours 6

Main:
for w0 = 1 to years
    gosub year_pause
next
for w0=1 to days
    gosub day_pause
next
for w0=1 to hours
    gosub hour_pause
next
stop

year_pause:
    for w1=1 to 365
        gosub day_pause
    next
    return

day_pause
    for w2=1 to 24
        gosub hour_pause
    next
    return

hour_pause:
    for w3=1 to 3600
        pause 1000
    next
    return
An accuracy can be a problem: With 1% accuracy you have 3day accuracy in the 1 year delay.
So, when it is not acceptable for you, use clock chip,as proposed manuka
 

AllyCat

Senior Member
Hi,

There are lots of ways to "skin a cat" (Code shown for simulation/test) :
For "real time" remove the comment character ( ; ) at the start of the "wait" line
Code:
#picaxe 08m2
#no_data
#terminal 4800
symbol minute = b1
symbol hour   = b2
symbol week   = b3
symbol year   = w2
year = 2019
do
    for week = 1 to 52                ;  weeks in a year
        for hour = 0 to 167            ; 168 hours in a week = 24 * 7
            for minute = 0 to 59        ; 60 minutes in an hour
;                wait 60                    ; Seconds (or pause 60000) for one minute
                 sertxd("Week ",#week," hrs : min ",#hour,":",#minute,cr,lf)
            next minute
        next hour
    next week
    year = year + 1
    sertxd(#year, " Another Year Gone",cr,lf)
loop
And even an "08" could handle the age of the universe. :)
Code:
#picaxe 08
; #no_data      ; Not with an 08
#terminal 2400
symbol minute = b1
symbol hour   = b2
symbol week   = b3
symbol year   = b4
symbol century = b5
symbol millions = w3
millions = 14000                        ; About 14 billion years ;-)
century = 20
year = 19
week = 43
hour = 167                                ; Will wrap-around soon
do                                            ; Each million years
    do                                        ; Each century
        do                                    ; Each year
            serout 0,n2400_4,("Year ",#millions,#century,#year,cr,lf)     
            do                                ; Each week
                do                            ; Each hour
                    do                        ; Each minute
                        serout 0,n2400_4,("Week ",#week," hour ",#hour," minute ",#minute,cr,lf)
;                        wait 60                            ; Seconds
                        minute = minute + 1 // 60
                    loop until minute = 0            ; Minute has wrapped around
                    hour = hour + 1 // 168            ; Hours numbered 0 .. 167 (1 week)
                loop until hour = 0                    ; Hour has wrapped around
                week = week // 52 + 1                ; Weeks numbered 1 .. 52
            loop until week = 1                        ; Week has wrapped around
            year = year + 1 // 100
        loop until year = 0                            ; Year has wrapped
        century = century + 1 // 10000
    loop until century = 0                            ; Century has wrapped
    millions = millions + 1
loop
Cheers, Alan.
 
Last edited:

lamxe

Senior Member
Dear Alan and StefanST
Thanks so much for the detailed tutorial, it's easy for me to learn. Thanks again for your kind attention and guideline and your time for me.
Best regard
lam
 
Top