Adj for Day Light Saving Time..........Is there any thing wrong with the way th
Hi Every One
I want to use the Month·Jan to Dec Date 1 to 31 and the day of the week
Sun to Sat
I know that with hrs = $00 and mins = $00 and secs = $00
are used to control any thing that you want
But what do you use for Month and Date and day of the Week
to control them
Do you need the $ before the # for this to work like you need for the
hrs , mins and the secs
And are they the # for Month or they the name of the month
I Goggle this before I ask this and could not find any thing on this can any one help or has any one done before
Thanks to any one that can help
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·that you may have and all of your time finding them
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 3/25/2008 5:13:16 AM GMT
I want to use the Month·Jan to Dec Date 1 to 31 and the day of the week
Sun to Sat
I know that with hrs = $00 and mins = $00 and secs = $00
are used to control any thing that you want
But what do you use for Month and Date and day of the Week
to control them
Do you need the $ before the # for this to work like you need for the
hrs , mins and the secs
And are they the # for Month or they the name of the month
I Goggle this before I ask this and could not find any thing on this can any one help or has any one done before
Thanks to any one that can help
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
![idea.gif](http://forums.parallax.com/images/smilies/idea.gif)
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 3/25/2008 5:13:16 AM GMT
Comments
http://www.parallax.com/Portals/0/Downloads/docs/prod/appkit/ds1302rtc.pdf
The example code shows how to decode the Month, Day and Date capabilities. You have to translate the month (1-12) and the Date (1-7) into text strings in your code. The sample program in the document above also shows how to make the translations.
Thank You for your reply
Here is what i came up with
Dose any one see any wrong with this routine I am using the DS1302 Demo Code to set the clock and took out the setting of the clock routine
start:
· GOSUB Get_Time
·· DEBUG HOME , HEX2 month, "/", HEX2 date, CR,
···· HEX2 hrs, ":", HEX2 mins, ":", HEX2 secs, CR
···· LOOKUP (day - 1), [noparse][[/noparse]Sun, Mon, Tue, Wed, Thu, Fri, Sat], work
·· DO···················································································· · ' Display Day Abbreviation
··· READ work, ioByte······························································· · ' Read Each Character Into ioByte
··· IF (ioByte = 0) THEN EXIT······················································· ' If 0 then done
··· DEBUG ioByte········································································ ' Send Character To DEBUG Screen
··· work = work + 1·································································· · ' Increment Address
······························································································ ' Next Character, If 0 Then Done
·· 'This routine is for Day Light Saving adj Time
· IF month = $03 AND·(date > $14) AND day = $01 AND hrs = $00 AND mins = $00 THEN GOSUB hrs_adj
· IF month = $11 AND (date > $07) AND day = $01 AND hrs = $02 AND mins = $00 THEN GOSUB hrs_adj
········································ ( ^ I am not sure this part is right·the first week and the·second week of the month )
· 'This routine is for turning Power ON and OFF every week day at the same time and On all weekend
· IF day = $07 OR day = $01 THEN
·· HIGH 10
·· ELSE
· IF day = $02 AND hrs = $07 AND mins = $30 THEN
·· LOW 10
·· ELSE
· IF day > $02 AND day < $06 AND hrs = $17 AND mins = $00 THEN
· HIGH 10
· ELSE
· IF day > $02 AND day < $06 AND hrs = $07 AND mins = $20 THEN
·· LOW 10
· ENDIF
· ENDIF
· ENDIF
· ENDIF
· LOOP
·hrs_adj:
·hrs = $01
·GOSUB set_time
·RETURN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 3/25/2008 5:27:44 AM GMT
IF month = $11 AND (date > $07) AND day = $01 AND hrs = $02 AND mins = $00 THEN GOSUB hrs_adj
Your ">" should be an "=". The ">" will adjust the time every Sunday in March after the 14th at midnight and similarly for the second piece of code.
Hope this helps
The problem is if you use = instead of >
If Sunday dose not fall on the 7 or the 14 then it will not change the time
I test this last night
How you·would be able to have where it first·in week March ·and the·second week in Oct on Sunday
I open to any
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam
Here is a snippet of code that might give you some ideas. In my neighborhood we have to watch out for the third Monday morning of every month, because we have to have the car off the street for street sweeping, otherwise we get a fat parking ticket. The cost of urban life. So this clock routine (abbreviated) gives a warning on the day before the third Monday and again on the day itself. You need a similar calculation to find the day for rollover of daylight savings.
I don't use the "day" variable from the RTC. Instead, I calculate it from the Julian day number (JDN), which is simply a count of the number of days from 1/1/2001. (= day #1 in this scheme). You will see the calculation for JDN in the attached subroutine. It returns the JDN of any mm/dd/yy passed to it. It so happened that 1/1/2001 was a Monday, so it is then easy to calculate the day of the week,
dow=JDN // 7.
The routine below figures out the day of the week of the first of the current month, and from that, the date of the third Monday. Note the conversions from BCD time to binary time.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Here's yet another example...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 3/26/2008 7:26:34 AM GMT
The day will always be 01 so that can be checked by day = 1
The month and hour can be check in the same way.
Now what we need to do is figure out the range of dates that will be the second Sunday.
The earliest it would be is if a Sunday is the first day of the month. This would mean that the second Sunday would be the 8th day in the month.
The latest it would be is if a Monday is the first day of the month. This would mean that the second Sunday would be the 14th day in the month.
So you checking code would be
IF month = $03 AND (date => $8) AND (date =< 14) AND day = $01 AND hrs = $00 AND mins = $00 THEN GOSUB hrs_adj
You will of course have to adjust for which day you want.
Hope this helps
Thank You for all of your input·and ·
Work
I wanting to built a timer to control the TV, Cable Box·,·Speaker Amp CD· Changer
Which all use Stand By Power when they are OFF
In this Months Nuts and Volt there is story about how much it cost a year just for··Stand By Power useage The cost was about $200.00 year· WOW!!!!!!!
So I thought it was time to put a STOP to Waste Full use of electircty when a Basic Stamp
Board that you put together is $30.00 and a hand full of other·part that would not cost to much
I still would save about $150.00 in the First Year
I was Think about the fact if the price of OIL keep going UP then the price of KILWATT per
Hour will go up agian we just had a rate hike last year· $0.03 per kilwatt hour
This is the reason I have so·busy working on different types of·timers· that need to be controled and only run when need
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam
1. You have or will develop some method for killing the power to the devices you listed using the Basic Stamp.
2. All of the devices have some type of infrared remote control. Its the device keeping the ir circuits active to watch for the power button that uses the standby power.
3. You were planning to cycle the power to the devices off·/ on based on a schedule to cut energy usage. You also·didn't want the schedule to shift every spring and fall due to daylight savings time, or whenever congress gets the·urge to change it to.
The idea is based on the fact that the Infrared sensors sold by Parallax can detect the signal from most remote controllers. The IR Remote for the Boe-Bot Parts Kit and Text explains how to decode Sony based controllers to control a Boe-Bot, but all that matters is that the ir sensor can detect the remote. You really don't care which remote or what button is being pressed, just that someone is using a remote. Set your system up to monitor the IR sensor to detect that a remote is being used. When it sees a remote, it turns on the power to the devices and reads the clock to get a time. You then add an hour to the time (or whatever interval you like) to act as the cut-off time. If the current time reaches the cut off time and it hasn't seen any more ir remote activity, turn the power off. I've included a pdf of the logic flow.
In other words instead of a timer, you've got a dead man's switch. You only provide power to the devices when they are actually being used. You don't need to decode the ir remote signals - any button keeps it going. You also don't need to actually set the clock on the DS1302 since you are only using it to time an interval.
I like your·
Thank you for your·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam
Set your system up to monitor the IR sensor to detect that a remote is being used. When it sees a remote, it turns on the power to the devices and reads the clock to get a time. You then add an hour to the time (or whatever interval you like) to act as the cut-off time. If the current time reaches the cut off time and it hasn't seen any more ir remote activity, turn the power off. I've included a pdf of the logic flow.
In other words instead of a timer, you've got a dead man's switch. You only provide power to the devices when they are actually being used. You don't need to decode the ir remote signals - any button keeps it going. You also don't need to actually set the clock on the DS1302 since you are only using it to time an interval.
· I just ordered this Today.....>>>>>> IR Remote for the Boe-Bot Parts Kit and Text
http://www.parallax.com/Store/Education/KitsandBoards/tabid/182/ProductID/322/List/1/Default.aspx?SortField=ProductName,ProductName
I am going to go through the Book until·I understand how to use this setup
Then i am going to setup something that are along the same line that you have point
·and follow the outline that you have ·above
But i will have work out the details how i want it work
And I may update this as well
I do not have a··Boe-Bot· at least not the new ones I have the one that you had to put this one together so there is no room to add this very easyly but we wiil see
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 3/28/2008 4:28:03 PM GMT