Please Check this Routine for me ................Thanks to anyone that can help
Hi, EveryOne
I am using the DS1302
I am using a LED as a Switch
·I wrote this Routine can any one see anything wrong with way i wrote it
·······························![idea.gif](http://forums.parallax.com/images/smilies/idea.gif)
·
This is part of the main Routine i am using
Nextday:
mins = $00
secs = $00
GOSUB Set_Time
Look:
DO
HIGH led··········· · '· Some changes where made for this this code to work
LOW chg············· '· In My Project I would like to Thank Sid For Posting
PAUSE dly1·········· '· His Code This made this part easer for me to make this
'charge··············· '· work
LOW led·············· '· This is One LED Switch
HIGH chg
PAUSE dly1
'input
LOW led
INPUT chg
PAUSE dly2··········· 'Changing This Value Will Change The Light Level Respone
DEBUG CR, DEC ? chg
PAUSE dly3
·· GOSUB Get_Time
· DEBUG HOME, HEX2 hrs, ":", HEX2 mins, ":", HEX2 secs
LOOP UNTIL chg = 1
·SELECT· mins
·CASE $03
·GOTO Timer1
·CASE $04
·GOTO Timer2
·CASE $05
·GOTO Timer3
·CASE $06
·GOTO Timer4
·CASE $07
·GOTO Timer5
·ENDSELECT
·IF mins > $01 THEN
·GOTO look
·ENDIF
·RETURN
Timer__1···· To· Timer___5
hrs· = $00
mins = $00
secs = $00
GOSUB Set_Time
DEBUG CLS, CLS
DO
DEBUG CR,CR, "RUN TIMER__ CLOCK"
·· GOSUB Get_Time
· DEBUG HOME, HEX2 hrs, ":", HEX2 mins, ":", HEX2 secs
·GOSUB Get_Time
· DEBUG HOME, HEX2 hrs, ":", HEX2 mins, ":", HEX2 secs
· IF hrs = $00 AND mins = $00 AND secs = $05 THEN
· HIGH ledon
· HIGH relay
· ENDIF
· IF hrs = $__ AND mins = $__ THEN· EXIT·················· ' __3 mins·of sun light· =··__7···mins of ON TIME
· LOOP··································································' __4 mins·of sun light··=·__·6···mins of·ON TIME
· LOW ledon·························································· '__·5 mins·of sun light··=·__·5···mins·of ON·TIME
· LOW relay···························································'__· 6 mins·of sun light··=·__·4···mins·of ON·TIME
· DEBUG "STOP·__ MINS"·········································'__· 7 mins·of sun light· =·__·3·· minsof ON· TIME
· GOTO NextDay
This code works ok·as far as i have test it
·I want to know if this·right way to write·this routine
Or have i over looked something
Sam
Post Edited (sam_sam_sam) : 9/10/2006 12:10:54 AM GMT
I am using the DS1302
I am using a LED as a Switch
·I wrote this Routine can any one see anything wrong with way i wrote it
·······························
![idea.gif](http://forums.parallax.com/images/smilies/idea.gif)
·
This is part of the main Routine i am using
Nextday:
mins = $00
secs = $00
GOSUB Set_Time
Look:
DO
HIGH led··········· · '· Some changes where made for this this code to work
LOW chg············· '· In My Project I would like to Thank Sid For Posting
PAUSE dly1·········· '· His Code This made this part easer for me to make this
'charge··············· '· work
LOW led·············· '· This is One LED Switch
HIGH chg
PAUSE dly1
'input
LOW led
INPUT chg
PAUSE dly2··········· 'Changing This Value Will Change The Light Level Respone
DEBUG CR, DEC ? chg
PAUSE dly3
·· GOSUB Get_Time
· DEBUG HOME, HEX2 hrs, ":", HEX2 mins, ":", HEX2 secs
LOOP UNTIL chg = 1
·SELECT· mins
·CASE $03
·GOTO Timer1
·CASE $04
·GOTO Timer2
·CASE $05
·GOTO Timer3
·CASE $06
·GOTO Timer4
·CASE $07
·GOTO Timer5
·ENDSELECT
·IF mins > $01 THEN
·GOTO look
·ENDIF
·RETURN
Timer__1···· To· Timer___5
hrs· = $00
mins = $00
secs = $00
GOSUB Set_Time
DEBUG CLS, CLS
DO
DEBUG CR,CR, "RUN TIMER__ CLOCK"
·· GOSUB Get_Time
· DEBUG HOME, HEX2 hrs, ":", HEX2 mins, ":", HEX2 secs
·GOSUB Get_Time
· DEBUG HOME, HEX2 hrs, ":", HEX2 mins, ":", HEX2 secs
· IF hrs = $00 AND mins = $00 AND secs = $05 THEN
· HIGH ledon
· HIGH relay
· ENDIF
· IF hrs = $__ AND mins = $__ THEN· EXIT·················· ' __3 mins·of sun light· =··__7···mins of ON TIME
· LOOP··································································' __4 mins·of sun light··=·__·6···mins of·ON TIME
· LOW ledon·························································· '__·5 mins·of sun light··=·__·5···mins·of ON·TIME
· LOW relay···························································'__· 6 mins·of sun light··=·__·4···mins·of ON·TIME
· DEBUG "STOP·__ MINS"·········································'__· 7 mins·of sun light· =·__·3·· minsof ON· TIME
· GOTO NextDay
This code works ok·as far as i have test it
·I want to know if this·right way to write·this routine
Or have i over looked something
Sam
Post Edited (sam_sam_sam) : 9/10/2006 12:10:54 AM GMT
Comments
Here is the code routine·below
Sam