Set Date-Month-Year with Real Time Clock
Moderator: Benj
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Set Date-Month-Year with Real Time Clock
Hello everyone
How do I set Date, Month and Year?
Would you like to help with a code example?
Please see below! see Attachment file:
How do I set Date, Month and Year?
Would you like to help with a code example?
Please see below! see Attachment file:
Best Regard
Monie
Monie
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 44 times
- Been thanked: 60 times
- Contact:
Re: Set Date-Month-Year with Real Time Clock
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.
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.
- Attachments
-
- Ur_Test2.fcfx
- (25.47 KiB) Downloaded 241 times
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: Set Date-Month-Year with Real Time Clock
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
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
Best Regard
Monie
Monie
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 44 times
- Been thanked: 60 times
- Contact:
Re: Set Date-Month-Year with Real Time Clock
Hello Monie
Can you please attach the last version of your program so I can see what variables to use with buttons?
Thanks
Can you please attach the last version of your program so I can see what variables to use with buttons?
Thanks
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: Set Date-Month-Year with Real Time Clock
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:
Can't get Date to update though. Can you see where things are going wrong?
Here is my latest version of codes!
See attached:
Best Regard
Monie
Monie
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 44 times
- Been thanked: 60 times
- Contact:
Re: Set Date-Month-Year with Real Time Clock
Can I ask you a question Monie?
What is this project about? Is it a timer only? Is it a clock?
What is this project about? Is it a timer only? Is it a clock?
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: Set Date-Month-Year with Real Time Clock
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
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
Best Regard
Monie
Monie
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 44 times
- Been thanked: 60 times
- Contact:
Re: Set Date-Month-Year with Real Time Clock
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.
-----------------------
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.
- Attachments
-
- diagram-1.jpg (91.78 KiB) Viewed 4935 times
-
- Posts: 484
- Joined: Mon Jul 30, 2012 3:39 pm
- Has thanked: 17 times
- Been thanked: 46 times
- Contact:
Re: Set Date-Month-Year with Real Time Clock
Hi viktor_au
Thank you so much for your description and suggestions.
I will test your suggestions
Will start working on your suggestions!
Thank you so much for your description and suggestions.
I will test your suggestions
Will start working on your suggestions!
Best Regard
Monie
Monie
-
- Posts: 342
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 44 times
- Been thanked: 60 times
- Contact:
Re: Set Date-Month-Year with Real Time Clock
Good luck with your project Monie.
Please do one step at a time and everything would be OK.
Please do one step at a time and everything would be OK.