Process timer

davidwf

Senior Member
Has anyone designed a process timer....the sort of thing where you would set a required time delay - perhaps on thumbwheel switches, press start and it would operate say a relay whilst counting down to zero then turning off.

I have searched but couldn't really find anything suitable

thanks

Dave Faulkner
 

hippy

Ex-Staff (retired)
I haven't seen anything which specifically does that, but it should be easy enough to roll your own. Split the design into two main parts, hardware and software and sub-divide those as well ...

Hardware

1) Thumb wheel or other time selection means
2) Relay drive
3) Progress / elapsed time indicator ( if any )
4) End of time indicator ( if any )

Software

1) Input scanner
2) Input initiator
3) Time delay
4) Relay driving
5) Control of progress indicator ( if any )
6) Control of end of time indicator ( if any )

A major part of the design is a Functional Specification which defines what you want and how it will work in practice. How to set a time, how to initiate the timer, what happens when it finishes. You may also want to consider other things outside the scope of normal operation; how to restart or alter the time or stop it once it's been initiated.

This doesn't have to be a novel worthy of a Booker Prize but enough that you know what you're aiming for and need to do. It will also help others understand exactly what you're trying to do if you need help along the way.
 

ArnieW

Senior Member
Has anyone designed a process timer....the sort of thing where you would set a required time delay - perhaps on thumbwheel switches, press start and it would operate say a relay whilst counting down to zero then turning off.

I have searched but couldn't really find anything suitable

thanks

Dave Faulkner
Hi Dave,

I posted a code snippet on this kind of thing using an X1 picaxe with settimer. It is not exactly what you are asking about, but it might give some ideas.

cheers, Arnie
 

davidwf

Senior Member
mmmmmm.....some food for thought....will take a look after I've finished the current project - quite a while hence then !

Thanks for the ideas
Dave F
 

kevrus

New Member
Davidwf, this is the code for a countdown timer using an LCD that I incorporated into my U.V. light box, it's not amazingly accurate but is sufficient for my purposes as my exposure time is only 120secs. Setting the time is in 20sec increments and 10 sec decrements but these values can easily be changed. It may give you some ideas.

Code:
'U.V. LIGHT BOX TIMER 
'    USING 18X
start:
pause 50
serout 4,t2400,(254,1,12)
pause 100


main:
serout 4,t2400,(254,128," U.V. LIGHT BOX ")
serout 4,t2400,(254,192," EXPOSURE TIMER ")

look_again:
if pin0=0 then look_again


display:
b5=1
serout 4,t2400,(254,128,"  SET EXP TIME  ")
serout 4,t2400,(254,192,"   in seconds   ")
if pin0=0 then test
goto display


display1:
b5=2
serout 4,t2400,(254,128,"  DECREASE TIME ")     
if pin0=0 then test
goto display1


display2:
b5=3
serout 4,t2400,(254,128,"     START      ")
serout 4,t2400,(254,192,"   COUNTDOWN    ")
if pin0=0 then test
goto display2


test:
pause 5
branch b5,(main,set_time,dec_time,countdown_to_10)
goto test


set_time:
if pin1=0 then goto inc_1
serout 4,t2400,(254,128,"  SET EXP TIME  ")
serout 4,t2400,(254,192,"   ",#w1," seconds   ")
let b0=20
w1=w1+b0
serout 4,t2400,(254,192,"   ",#w1," seconds   ")
pause 5


release_up_button:
b5=0
for b5=b5 to 250
if pin1=0 then goto inc_1
if b5=250 then gosub cont_up
next b5
pause 2
if pin1=1 then goto release_up_button
pause 5
goto inc_1
  
  
cont_up:
let b0=20
w1=w1+b0
serout 4,t2400,(254,192,"   ",#w1," seconds   ")
pause 200
if pin1=1 then  cont_up
return

	
inc_1:
if pin1=1 then set_time
pause 5
if pin0=1 then display1
goto inc_1


dec_time:
if w1<10 then main
if pin1=0 then goto inc_2
serout 4,t2400,(254,128,"  DECREASE TIME ")
let b0=10
w1=w1-b0 min 10
serout 4,t2400,(254,192,"   ",#w1," seconds   ")
pause 5


release_down_button:
b5=0
for b5=b5 to 250
if pin1=0 then goto inc_2
if b5=250 then gosub cont_down
next b5
pause 2
if pin1=1 then goto release_down_button
serout 4,t2400,(254,128,"  DECREASE TIME ")
pause 5
goto inc_2


cont_down:
let b0=10
w1=w1-b0
serout 4,t2400,(254,192,"   ",#w1," seconds   ")
pause 200
if pin1=1 then cont_down
return


inc_2:
if pin1=1 then dec_time
pause 5
if pin0=1 then display2
goto inc_2


countdown_to_10:
if pin0=1 then display
if pin1=0 then countdown_to_10
high 7
setint %00000001,%00000001
serout 4,t2400,(254,128,"  U.V. lights    ")
serout 4,t2400,(254,192,"  powering up   ")
pause 2000
serout 4,t2400,(254,128," TIME REMAINING ")
for w1=w1 to 10 step-1
serout 4,t2400,(254,192,"   ",#w1," seconds   ")
if w1<10 then goto countdown_to_0
pause 765
serout 4,t2400,(254,192,"   ",#w1)
sound 6,(100,6)
low 6
next w1


countdown_to_0:
serout 4,t2400,(254,128," TIME REMAINING ")
if w1=0 then goto display
for w1=w1 to 0 step-1
serout 4,t2400,(254,195,"0",#w1," seconds   ")
pause 765
serout 4,t2400,(254,195,"0",#w1)
sound 6,(100,6)
low 6
if w1=0 then goto finish
next w1


interrupt:
low 7
serout 4,t2400,(254,128,"SYSTEM PAUSED AT")
serout 4,t2400,(254,192," < ",#w1," seconds   ")
if pin0=1 then interrupt
gosub resume 
setint %00000001,%00000001
serout 4,t2400,(254,128," RESUME SYSTEM  ")
serout 4,t2400,(254,192,"   COUNTDOWN    ")
pause 2000
high 7
serout 4,t2400,(254,128,"  U.V. lights    ")
serout 4,t2400,(254,192,"  powering up   ")
pause 2000
serout 4,t2400,(254,128," TIME REMAINING ")
serout 4,t2400,(254,192,"   ",#w1," seconds   ")
return


resume:
if pin1=0 then resume
pause 5
return


finish:
low 7
setint 0,0
sound 6,(100,150)
pause 990
goto final


final:
serout 4,t2400,(254,128," exposure time  ")
serout 4,t2400,(254,192,"   completed!   ")
pause 900
check:
if pin1=1 then main
goto check
Please be aware that my coding is always inefficient and messy so there will be scope for improvement...i'm not very good at this.

Apologies as I havn't commented the code...
 
Top