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: 25 times
Been thanked: 188 times
Contact:

DS1307 - RTC Time Keeper

Post by Jordy101091 »

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 1304 times

Download:

V1.64
DS1307.fcpx
DS1307 Component Version V1.64
(12.16 KiB) Downloaded 1069 times
V1.65
DS1307.fcpx
DS1307 Component Version V1.65
(12.12 KiB) Downloaded 1286 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.
the will to learn, should not be stopped by any price

wayne millard
Posts: 234
Joined: Thu May 31, 2007 2:18 pm
Has thanked: 7 times
Been thanked: 12 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by wayne millard »

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: 364 times
Been thanked: 716 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by JohnCrow »

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: 25 times
Been thanked: 188 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by Jordy101091 »

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.
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

Post by manuel_bayer »

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: 25 times
Been thanked: 188 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by Jordy101091 »

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

Post by manuel_bayer »

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: 25 times
Been thanked: 188 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by Jordy101091 »

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: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by Benj »

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

Post by manuel_bayer »

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: 783 times
Been thanked: 223 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by acestu »

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: 25 times
Been thanked: 188 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by Jordy101091 »

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
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: 783 times
Been thanked: 223 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by acestu »

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: 25 times
Been thanked: 188 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by Jordy101091 »

Hi acestu,

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

Regards Jordy
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: 783 times
Been thanked: 223 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by acestu »

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: 25 times
Been thanked: 188 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by Jordy101091 »

Can you clarify this a bit more,

Do you mean something of time controlled ON/OFF switch
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: 783 times
Been thanked: 223 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by acestu »

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: 25 times
Been thanked: 188 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by Jordy101091 »

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

Regards Jordy
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: 783 times
Been thanked: 223 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by acestu »

Hi Jordy,

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


http://www.matrixmultimedia.com/mmforum ... 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: 25 times
Been thanked: 188 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by Jordy101091 »

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:
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: 783 times
Been thanked: 223 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by acestu »

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: 234
Joined: Thu May 31, 2007 2:18 pm
Has thanked: 7 times
Been thanked: 12 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by wayne millard »

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: 783 times
Been thanked: 223 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by acestu »

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: 783 times
Been thanked: 223 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by acestu »

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: 25 times
Been thanked: 188 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by Jordy101091 »

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

Post Reply