DS1307 - RTC Time Keeper

A forum where Flowcode v6 user created components can be shared, discussed and reviewed.

Moderator: Benj

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

DS1307 - RTC Time Keeper

Postby Jordy101091 » Sat Sep 14, 2013 10:25 pm

DS1307 - Component
Current Version = 1.65
Best working version = 1.65



Info:
I thought it would be really nice if we could program the DS1307 with just a few macros.
In the past you would have a couple of macro calls to communicate and setting up the DS1307, well not anymore.

I have made a DS1307 component which lets you easy use the DS1307 device and configure it. No need to have difficult calculations.
With this component you can just put in your time and date data in decimal values the component takes care of the rest. A nice thing is that you can choose what the behaviour is of the SQW output.
Via a simple pull down menu you can select what the output frequency is.
This component uses just 9 component macros:

- Initialise
- DayOfWeek
- ReadDate
- ReadTime
- WriteDate
- WriteTime
- AutoTimeAdjust
- TimerUpdate
- CheckTimerBit

(A help file will be attached for those that doesn't understand the function of every macro)

Component Use:
The component can be used by copying the ".fcpx" file into the component directory of Flowcode v6.
Then component can be found under the tap inputs as DS1307.

Future Updates:

Future update will include:

--

Help File:
DS1307 Help V1.63.zip
Help file Version V1.63
(243.79 KiB) Downloaded 761 times



Download:

V1.64
DS1307.fcpx
DS1307 Component Version V1.64
(12.16 KiB) Downloaded 560 times


V1.65
DS1307.fcpx
DS1307 Component Version V1.65
(12.12 KiB) Downloaded 748 times


ChangeLog:

V1.1 = Added the ability to use different time and date delimiters.
V1.2 = Added the ability to use BST (British Summer Time) time adjustment ----> Note: AutoTimeAdjust macro needs to be called for BST to work!!!
V1.3 = Added Timer Clock Functionality, the user can enable up to 10 timers.
------- DS1307 Injector component integrated for correct simulation
V1.4 = Added Automatic calculation of Day of Week --> Valid up to 2199
------- Configurable Timer outputs fixed so they can be used
V1.5 = Removed Automatic Calculation of Day Of Week, the reason is that its a complex algorithm and it uses floating point calculation.
------- This uses a lot of space that small uC do not have, so for that reason I have removed it.
------- Added the ability to read back the time in 12Hr or 24Hr Format.
------- Added the ability to configure the timers in 12Hr or 24Hr mode.
V1.6 = Added the ability to choose between different return values for the Day of Week.
------- Number: this will return a number corresponding the Day of week (1 for sunday, 2 for Monday and so on)
------- First Three Chars: this will return the first three characters of the day of week
------- Whole Word: this will return the whole word for the day of week
V1.61 = Fixed timer issue with Timers 9 and 10 not coming on.
------- Changes the Component Icon to a submitted icon of acestu
V1.62 = Improved TimerUpdate macro by requesting the output pin status, for better return value result.
V1.63 = Fixed an issue with the TimerUpdate macro that returns false results and output pin flickering.
--------- Added a new macro CheckTimerBit, this macro can be used to check the timer status bits.
V1.64 = the communication pins do not default after re-opening the program.
--------- Added a new variable which lets you use the output pins.
--------- Timers can now be used without the need to use the output pins.
V1.65 = Added an Improved calculation for "Day Of Week" the DOW doesn't need to be given from version 1.65 and higher.

Attention:

Automatic Time Adjustment (BST);
- The "AutoTimeAdjust" macro needs to be called periodically for this functionality to work properly

Timer Clock;
- The "TimerUpdate" macro needs to be called periodically for this function to work properly
- The time need to be entered without delimiter for example NOT 22:00 BUT 2200 The same for NOT 06:00 BUT 600
- Don't forget to specify the timer that needs to update ( 1 to 10 )
- Timer outputs can only be configured if the corresponding timer is also enabled!!!
- 24Hr Time format is selected then AM/PM I the component properties menu is greyed out.
Last edited by Jordy101091 on Fri Jan 03, 2014 3:50 pm, edited 21 times in total.
These users thanked the author Jordy101091 for the post (total 7):
medelec35 (Sat Sep 14, 2013 10:54 pm) • JohnCrow (Sun Sep 15, 2013 8:20 am) • dazz (Sun Sep 15, 2013 11:09 am) • jgu1 (Mon Sep 16, 2013 6:36 am) • acestu (Mon Sep 30, 2013 1:57 pm) • Benj (Tue Oct 22, 2013 12:12 pm) • cb28 (Tue Dec 29, 2015 12:11 pm)
Rating: 41.18%
 
the will to learn, should not be stopped by any price

wayne millard
Posts: 222
Joined: Thu May 31, 2007 2:18 pm
Has thanked: 6 times
Been thanked: 11 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby wayne millard » Sun Sep 15, 2013 12:34 am

Nice work on keeping it easy which it is not using and is now.

Wayne

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 381 times
Been thanked: 713 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby JohnCrow » Sun Sep 15, 2013 8:39 am

Hi Jordy
Thats a great addition to the components.

Makes using the RTC device a lot easier. Remember first time I used it, doing a bit of head scratching witht the datasheets.I2C is quite difficult for beginners to use.

One suggestion for an improvement, is it possible to have a used selection of the dividers
i.e. / \ - : or something simliar.
Also it defaults to Port F, and wont stay on port C on my flowchart using a 16F877A even after saving, goes back to F when reloaded, but works fine once programmed.

Thanks
1 in 10 people understand binary, the other one doesn't !

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby Jordy101091 » Sun Sep 15, 2013 10:35 am

Oke, I will try to fix the problem with the port settings.
For the dividers this is easy to implement so I will look into this and see if I can release an update later today.
These users thanked the author Jordy101091 for the post (total 2):
JohnCrow (Sun Sep 15, 2013 11:36 am) • acestu (Mon Nov 11, 2013 6:11 pm)
Rating: 11.76%
 
the will to learn, should not be stopped by any price

manuel_bayer
Posts: 10
Joined: Wed Oct 16, 2013 1:55 am
Contact:

Re: DS1307 - RTC Time Keeper

Postby manuel_bayer » Mon Oct 21, 2013 6:48 pm

it doesnt work with atmega 328p for example?!

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby Jordy101091 » Mon Oct 21, 2013 9:29 pm

manuel_bayer wrote:it doesnt work with atmega 328p for example?!


Can you be more specific with you problem, I do not work with Atmel microcontrollers so it very difficult to help you with this.
I hope you can be more specific about you're problem.

Don't get me wrong I would like to help you with this.

Regards Jordy
the will to learn, should not be stopped by any price

manuel_bayer
Posts: 10
Joined: Wed Oct 16, 2013 1:55 am
Contact:

Re: DS1307 - RTC Time Keeper

Postby manuel_bayer » Mon Oct 21, 2013 10:12 pm

hi,

If is set the Time to the RTC for example, and want to read it later form the RTC, it only returns zeros.
Or can i only simulate the Project in Proteus???

Greets!!
Attachments
ds1307.png
screenshot
(240.87 KiB) Downloaded 9429 times

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby Jordy101091 » Tue Oct 22, 2013 11:49 am

Manual Bayer,

This component when in simulation mode doesnt return usefull data.
You need to use this in hardware or in a simulation program such as proteus that simulate the hardware.

I hope this answer covers you question.
If you have any trouble please post your question,
Also if you have any component suggestions let me know.

Regards jordy
the will to learn, should not be stopped by any price

User avatar
Benj
Matrix Staff
Posts: 13948
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4224 times
Been thanked: 3980 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby Benj » Tue Oct 22, 2013 12:14 pm

Hi Jordy,

The DS1307 Injector will perform the simulation side of things for you. Can you add it into your component, link it to the I2C Master component and then your component should simulate correctly.

manuel_bayer
Posts: 10
Joined: Wed Oct 16, 2013 1:55 am
Contact:

Re: DS1307 - RTC Time Keeper

Postby manuel_bayer » Tue Oct 22, 2013 12:51 pm

thanks alot,

in proteus it also returns strange data.
I am sure that everything is connected correctly.
Has anyone else used the component with an avr Chip?
Maybe i have to create my own component...:(

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby acestu » Thu Oct 31, 2013 1:26 am

Hi Jordy,

I was just wondering if the second download component automatically updates the time for BST , or is this something that you will be doing in the future?

thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby Jordy101091 » Thu Oct 31, 2013 8:28 pm

Hi Acestu,

When I have found some spare time, I will have a go with this.
I will let you know how its getting allong.

Regards Jordy
These users thanked the author Jordy101091 for the post:
acestu (Thu Oct 31, 2013 8:51 pm)
Rating: 5.88%
 
the will to learn, should not be stopped by any price

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby acestu » Thu Oct 31, 2013 8:51 pm

Hi Jordy,

First of all thank you for sharing a great component, and I really look forward to the auto BST version....

cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby Jordy101091 » Sat Nov 02, 2013 8:57 pm

Hi acestu,

I have updated the component with Auto BST functionality.
I hope you like it,

Regards Jordy
These users thanked the author Jordy101091 for the post (total 4):
medelec35 (Sat Nov 02, 2013 9:04 pm) • JohnCrow (Sat Nov 02, 2013 10:31 pm) • dazz (Sun Nov 03, 2013 1:54 pm) • acestu (Sun Nov 03, 2013 4:55 pm)
Rating: 23.53%
 
the will to learn, should not be stopped by any price

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby acestu » Sun Nov 03, 2013 5:01 pm

Hi Jordy,

Thanks for the excellent work, this is exactly what Flowcode needs for the beginners, after all that is what it is all about ie making embedded control easy for people who don't have a clue about programming, you asked me if I had any ideas for a component, well how about a Timeclock component which would include the BST DS1307 clock and the ability to add on-off periods output to a selectable pin, so it would be like the chart that I sent you only very easy to add or remove the timed periods, I think that would be awesome...

cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby Jordy101091 » Sat Nov 09, 2013 9:03 pm

Can you clarify this a bit more,

Do you mean something of time controlled ON/OFF switch
These users thanked the author Jordy101091 for the post:
acestu (Sun Nov 10, 2013 9:56 pm)
Rating: 5.88%
 
the will to learn, should not be stopped by any price

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby acestu » Sun Nov 10, 2013 9:54 pm

Hi Jordy,

yes if you could have a macro on your component that let you add an on-off timed period to send a selected pin high eg


On Time = 19.00
Off Time = 20.00

Selected Pin = B4


So you could control anything from pin B4 within your specified time range

Having multiple pins assignable would also give you the power to control more than 1 item at a time


This would be awesome because you would have a Timeclock in a component.

I hope this makes sense.

P.S. Benj said that you can add the DS1307 injector to your component and then it will simulate, he has posted a demo in the FC6 forum

cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby Jordy101091 » Mon Nov 11, 2013 5:10 pm

Ok now I now what you meant,
I will have a go with this and let you what the progress is.

Regards Jordy
These users thanked the author Jordy101091 for the post:
acestu (Mon Nov 11, 2013 6:12 pm)
Rating: 5.88%
 
the will to learn, should not be stopped by any price

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby acestu » Mon Nov 11, 2013 6:22 pm

Hi Jordy,

This is what Benj said about the DS1307 Injector, in case you had not seen it...


viewtopic.php?f=54&t=13113


thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby Jordy101091 » Thu Nov 14, 2013 8:15 pm

The component has been updated with the following functionality:

1 - Timer Clock
2 - Simulation capability

You can use up to 10 different timers with configurable ON - OFF time and Day of Week settings.

For example

ON = 6:00
OFF = 15:00
ON Day = Monday
OFF Day = Thursday

I hope you all like it,

Regards Jordy

PS. I really need to make a help document because this component is getting larger :wink:
These users thanked the author Jordy101091 for the post:
acestu (Thu Nov 14, 2013 10:00 pm)
Rating: 5.88%
 
the will to learn, should not be stopped by any price

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby acestu » Thu Nov 14, 2013 10:01 pm

Hi Jordy,

Thanks for doing this, I am going to have a play with it now....

Many Thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

wayne millard
Posts: 222
Joined: Thu May 31, 2007 2:18 pm
Has thanked: 6 times
Been thanked: 11 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby wayne millard » Thu Nov 14, 2013 10:14 pm

Hi Jordy,

can you please post your latest component so that I can try it out.

Thanks
Wayne :D

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby acestu » Thu Nov 14, 2013 10:16 pm

Hi Wayne,

It is already on here, go to the top and it is there ie version 1.3

cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby acestu » Fri Nov 15, 2013 12:30 am

Hi Jordy,

I think you are right about the help file, I can't work out how to use it :( , if you have any pointers could you post something.....

thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 27 times
Been thanked: 190 times
Contact:

Re: DS1307 - RTC Time Keeper

Postby Jordy101091 » Fri Nov 15, 2013 6:53 am

When I'm back from work today I will make a help file and a example program.

Sorry about this.

Regards Jordy
the will to learn, should not be stopped by any price