Page 1 of 1
Set Date-Month-Year with Real Time Clock
Posted: Tue Aug 20, 2019 6:48 am
by Monie Jacobsen
Hello everyone
How do I set Date, Month and Year
?
Would you like to help with a code example
?
Please see below!

- Date.JPG (44.58 KiB) Viewed 5724 times
see Attachment file:
Re: Set Date-Month-Year with Real Time Clock
Posted: Tue Aug 20, 2019 8:24 am
by viktor_au
Hello Monie Jacobsen
Please have a look at the added macro: SetTime.
I used your variables: Date, Year and added WeekDay (if you want to assign to week day (number) the text like 'Tuesday' later).
Date = 21
Year = 19
WeekDay = 2 //Tuesday
Please add more functions: RTC1:SetHours (:SetMinutes, :SetMonth).
Would be a good idea to add three buttons to change your clock settings - btn+, btn-, btn-set.
But this can be done later (if you need it).
------
Have a look at :
https://www.matrixtsl.com/wikiv7/index. ... _(Storage)
Please have a look at SetWeekDay, SetMonth, SetHours, etc.
All the best.
Re: Set Date-Month-Year with Real Time Clock
Posted: Tue Aug 20, 2019 8:59 am
by Monie Jacobsen
Hi viktor_au
Thank you so much for your suggestion it worked fine;-)
Have a really good day.
Would be a good idea to add three buttons to change your clock settings - btn+, btn-, btn-set.
I would very much like to have an example and use Keypad Board EB014 If that's ok
Yours sincerely
Monie
From Danmark
Re: Set Date-Month-Year with Real Time Clock
Posted: Tue Aug 20, 2019 11:17 pm
by viktor_au
Hello Monie
Can you please attach the last version of your program so I can see what variables to use with buttons?
Thanks
Re: Set Date-Month-Year with Real Time Clock
Posted: Wed Aug 21, 2019 6:17 am
by Monie Jacobsen
Hi viktor_au
Can't get Date to update though. Can you see where things are going wrong
?
Here is my latest version of codes
!
See attached:
Re: Set Date-Month-Year with Real Time Clock
Posted: Wed Aug 21, 2019 6:29 pm
by viktor_au
Can I ask you a question Monie?
What is this project about? Is it a timer only? Is it a clock?
Re: Set Date-Month-Year with Real Time Clock
Posted: Thu Aug 22, 2019 5:55 am
by Monie Jacobsen
Hi viktor_au
I only need the date month year and hour minute and second...
And want to be able to set the Time and Date setting with Keypad Board EB014
Re: Set Date-Month-Year with Real Time Clock
Posted: Fri Aug 23, 2019 12:02 am
by viktor_au
Understood Monie.
-----------------------
More questions to ask.
In you code - the button Reset (connected to E3) is basically a Set button.
This button waits for user response in two macros:
- in Main macro and
-in UR macro as well.
Why?
You set seconds in Main macro , compare the values of new and old seconds and print the result only if those values are not the same. Why do you compare the new and old seconds values and why only seconds?
Where do you get and print the Hours, Minutes, Seconds? I cannot find the code.
2. The UR macro is basically a Set time / date macro. But even if you set the time/date you cannot get out of this loop. No way to get out. Why?
Can you change your program Monie?
------------------------
Can you:
1. Print on 1st row of LCD the string with DD:MM:YY (compile this code and see what happens)
Reads the current date from the RTC and returns it formatted as a string. e.g. DD:MM:YY
2. Add more code and Print on 2nd row of LCD the string with HH:MM:SS.
This function reads the current time from the RTC and returns it formatted as a string. e.g. HH:MM:SS. (Compile this code and see what happens)
3. Add more code later: use the buttons to change the values of DD:MM:YY and HH:MM:SS
With buttons the code is more complex, but it can be done by you. Just move slowly...
P.S. Please note: RTC Set -> does not currently simulate. That is the reason to do programming in steps. Do step 1 and check the results, do step2 and check the results, so on...
Information to read:
viewtopic.php?f=5&t=4005 - 24 hrs Clock
https://www.youtube.com/watch?v=fHByry0gefA - Digital Clock LCD 16x2 Using PIC16F1937 (Note: Youtube video (I think Flowcode v.5). You would be able to see how the code is organised in macros, the Set-Get sequence, etc.
https://www.instructables.com/id/24hr-T ... a-Circuit/ - Great tutorial about clock program creation in Matrix Flowcode environment.
John Crow (author or many Flowcode related articles) pubished this one:
Developing your own Flowcode 7 controlled weather station (with info about DS1307 RTC)
https://www.rs-online.com/designspark/d ... er-station
All the best.
Re: Set Date-Month-Year with Real Time Clock
Posted: Sun Aug 25, 2019 6:28 pm
by Monie Jacobsen
Hi viktor_au
Thank you so much for your description and suggestions.
I will test your suggestions

Will start working on your suggestions
!
Re: Set Date-Month-Year with Real Time Clock
Posted: Sun Aug 25, 2019 11:13 pm
by viktor_au
Good luck with your project Monie.
Please do one step at a time and everything would be OK.