PDA

View Full Version : help with project



ryan4385
02-25-2010, 07:51 AM
i am designing a program that will close the garage door after 10 minutes. I have that part of the program done but would like to modify it so that if a switch is close that is disable the program but will not override the alarm clock part of the program using ds1302 and can show parts of the program on the lcd screen. Also if is possiable to always display the temperature not require

thank you for any help

Ryan

Post Edited (ryan4385) : 2/25/2010 4:45:42 AM GMT

JD
02-25-2010, 09:11 AM
Ryan,

A few questions; what is or is not working in the program that you have attached with the RTC program you want to merge.·Can you upload the entire program you want to use? The reason I ask, is that it's easier to offer suggestions when we have all the pieces.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,


Joshua Donelson
www.parallax.com (http://www.parallax.com)

ryan4385
02-28-2010, 05:50 AM
anyone got any suggestion?

Mike Green
02-28-2010, 06:05 AM
You've already gotten help from Joshua. My suggestion is to do what he asked.

Franklin
02-28-2010, 11:27 AM
Write code to do this:
IF switch = open
DoThis
endif
rest of your code

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

sam_sam_sam
02-28-2010, 11:47 AM
See If you can get this to work· this ·should help you do what you want to

·

' ================================================== =======================
'
' File...... DS1302_Counter_Demo.bs2
' Purpose... Demonstrate The DS1302 Clock & RAM Functions
' Author.... Chris Savage -- Parallax, Inc.
' E-mail.... csavage@parallax.com (mailto:csavage@parallax.com)
' Started...
' Updated... 10-09-2005
'
' {$STAMP BS2}
' {$PBASIC 2.5}
'
' ================================================== =======================


'
' Pin Assignments
' 0 DS1302 DataIO
' 1 DS1302 Clock
' 2 DS1302 Chip Select

' -----[ Revision History ]------------------------------------------------

' -----[ I/O Definitions ]-------------------------------------------------
DataIO PIN 4 ' DS1302.6
Clock PIN 3 ' DS1302.7
CS1302 PIN 5 ' DS1302.5

' -----[ Constants ]-------------------------------------------------------
WrSecs CON $80 ' Write Seconds
RdSecs CON $81 ' Read Seconds
WrMins CON $82 ' Write Minutes
RdMins CON $83 ' Read Minutes
WrHrs CON $84 ' Write Hours
RdHrs CON $85 ' Read Hours
CWPr CON $8E ' Write Protect Register
WPr1 CON $80 ' Set Write Protect
WPr0 CON $00 ' Clear Write Protect
WrBurst CON $BE ' Write Burst Of Data
RdBurst CON $BF ' Read Burst Of Data
WrRam CON $C0 ' Write RAM Data
RdRam CON $C1 ' Read RAM Data

' -----[ Variables ]-------------------------------------------------------
index VAR Byte ' Loop Counter
reg VAR Byte ' Read/Write Address
ioByte VAR Byte ' Data To/From DS1302
secs VAR Byte ' Seconds
secs01 VAR secs.LOWNIB
secs10 VAR secs.HIGHNIB
mins VAR Byte ' Minutes
mins01 VAR mins.LOWNIB
mins10 VAR mins.HIGHNIB
hrs VAR Byte ' Hours
hrs01 VAR hrs.LOWNIB
hrs10 VAR hrs.HIGHNIB
date VAR Byte
month VAR Byte
day VAR Nib ' Day
year VAR Byte ' Year

work VAR Byte ' Work Data

' -----[ Initialization ]--------------------------------------------------
Init:
reg = CWPr ' Initialize DS1302
ioByte = WPr0 ' Clear Write Protect
GOSUB RTC_Out ' Send Command

' -----[ Program Code ]----------------------------------------------------
Start:
mins = $00
secs = $00
GOSUB Set_Time
DO
GOSUB Get_Time
DEBUG HOME, HEX2 mins, ":", HEX2 secs
IF mins = $03 AND secs = $15 THEN EXIT
LOOP
DEBUG CR, CR, "3:15 Elapsed"
STOP ' <<<<<<<<<<

' The STOP line is not need when you put own code bellow

RETURN
' one note you may or may not this line this depends on how you write you code

' remove the stop and put what you want it to do
' and do not for get the RETURN line at the bottom
' of this routine
' -----[ Subroutines ]-----------------------------------------------------

RTC_Out:
HIGH CS1302 ' Select DS1302
SHIFTOUT DataIO, Clock, LSBFIRST, [reg, ioByte]
LOW CS1302 ' Deselect DS1302
RETURN
RTC_In:
HIGH CS1302 ' Select DS1302
SHIFTOUT DataIO, Clock, LSBFIRST, [reg]
SHIFTIN DataIO, Clock, LSBPRE, [ioByte]
LOW CS1302 ' Deselect DS1302
RETURN
Set_Time: ' DS1302 Burst Write
HIGH CS1302 ' Select DS1302
SHIFTOUT DataIO, Clock, LSBFIRST, [WrBurst]
SHIFTOUT DataIO, Clock, LSBFIRST, [secs, mins, hrs,
date, month, day, year, 0]
LOW CS1302 ' Deselect DS1302
RETURN
Get_Time: ' DS1302 Burst Read
HIGH CS1302 ' Select DS1302
SHIFTOUT DataIO, Clock, LSBFIRST, [RdBurst]
SHIFTIN DataIO, Clock, LSBPRE, [secs, mins, hrs, date, month, day, year]
LOW CS1302 ' Deselect DS1302
RETURN

I hope this helps

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them http://forums.parallax.com/images/smilies/smile.gif

·
·
·
·
Sam

Post Edited (sam_sam_sam) : 2/28/2010 4:07:18 AM GMT