View Full Version : how to code Day Month and Year on two

11-21-2009, 09:43 PM
и Need Help:

ииииииииииииииииииии I am looking for information on how to code Day Monthи and Year on two

иииииииииииииииииии Pushbuttion Control. Any help or code would be appreciated. I using a BS2E

иииииииииииииииииии Stamp.

иииииииииииииииииии Thanks Dogg.

Post Edited By Moderator (Bean (Hitt Consulting)) : 11/21/2009 2:49:41 PM GMT

11-22-2009, 01:38 AM
Can you show us what you have so far?

11-22-2009, 02:31 AM

иииииииии ииииии Here is the code That I am trying to design two Push-Buttons to Control.

иииииииии Date:

иииииииииииииииии Enter Month:

иииииииииииииииииииииииииииииииииииииии Serout 16,B96,[CR,"Enter Month (1.....12)..]
ииииииииииииииииииииииииииииииииииииииииSerin 16,B96,[DEC2 month]
ииииииииииииииииииииииииииииииииииииии иIF(month < 1) Or (Month > 12)Then Enter_Month

ииииииииииииииии иEnter_Day:
иииииииииииииииииииииииииииииииииииии и Serout 16,B96,[CR,"Enter Dayи (1....31).."]
иииииииииииииииииииииииииииииииииииии и Serinи 16,B96,[DEC2 day]
иииииииииииииииииииииииииииииииииииии и IF(dayи < 1) Or (day > 31)Then Enter_Day

иииииииииииии и Enter_Year:ииии
ииииииииииииииииииииииииииииииииииии ииSerout 16,B96,[CR,Enter Year (00).."]
иииииииииииииииииииииииииииииииииииии иSerin 16,B96,[DEC2 Year]
иииииииииииииииииииииииииииииииииииии иF(Year < 02)Then Enter Year

ииииииииииииииииAny assistance would be very much appreciated. I am only trying to Input the above

ииииииииииииии Information on two Pushbuttons switches to set the month day and year...

иииииииииииии Thank you for your time and input.и PS: Baud is 9600

Mike Green
11-22-2009, 02:39 AM
How do you want the pushbuttons to work? There are many many possible ways to do this. What do you want?

11-22-2009, 03:25 AM
ии Mike:

иииииииииии Thanks for the quick reply.

иииииииииии What I am trying to accomplish is take two N/O Pushbuttions to set the month day and year.

иииииииииии If this is possible.

ииииииииииииThe day would be set and then incremented to the month with the same pushbutton. And

ииииииииии finally the year would be set with the second Pushbutton. Any help would be appreciated.

ииииииииии Again thanks for the quick reply.

иииииииии Dogg..

Mike Green
11-22-2009, 04:03 AM
Of course it's possible. How are you going to do it? Do you know how to handle pushbuttons with a Stamp? If not, you should go though the "What's a Microcontroller?" tutorial from Parallax.

If you know how to handle pushbuttons, then how would you do what you want to do? What specific button presses would do what? It sounds from your description that you have a "mode" where the first mode is "set month", the second mode is "set day", and the third mode is "set year". Modes are also known as states in programming. How would you progress from the initial state to each of the three other states, then back? What might a pseudo-program look like? How would you keep track of what mode you're in? There are several different ways including the use of a variable or the use of a particular loop / label in the program.

11-22-2009, 04:58 AM

ии Mike:

ииииииииии Thanks for your Help.

ииииииииии Dogg

Mike Green
11-22-2009, 05:11 AM
Be sure to look at the BUTTON statement. There's a whole chapter in the BASIC Manual on that. The nice part is that it includes an auto-repeat function which you'd want to use for your situation. The user would be able to hold down the pushbutton and have the mode advance or have the number (month/day/year) advance without having to push once for each advance.