Page 1 of 6

DS1307 - RTC Time Keeper

Posted: Sat Sep 14, 2013 10:25 pm
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 1314 times

Download:

V1.64
DS1307.fcpx
DS1307 Component Version V1.64
(12.16 KiB) Downloaded 1078 times
V1.65
DS1307.fcpx
DS1307 Component Version V1.65
(12.12 KiB) Downloaded 1296 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.

Re: DS1307 - RTC Time Keeper

Posted: Sun Sep 15, 2013 12:34 am
by wayne millard
Nice work on keeping it easy which it is not using and is now.

Wayne

Re: DS1307 - RTC Time Keeper

Posted: Sun Sep 15, 2013 8:39 am
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

Re: DS1307 - RTC Time Keeper

Posted: Sun Sep 15, 2013 10:35 am
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.

Re: DS1307 - RTC Time Keeper

Posted: Mon Oct 21, 2013 6:48 pm
by manuel_bayer
it doesnt work with atmega 328p for example?!

Re: DS1307 - RTC Time Keeper

Posted: Mon Oct 21, 2013 9:29 pm
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

Re: DS1307 - RTC Time Keeper

Posted: Mon Oct 21, 2013 10:12 pm
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!!

Re: DS1307 - RTC Time Keeper

Posted: Tue Oct 22, 2013 11:49 am
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

Re: DS1307 - RTC Time Keeper

Posted: Tue Oct 22, 2013 12:14 pm
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.

Re: DS1307 - RTC Time Keeper

Posted: Tue Oct 22, 2013 12:51 pm
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...:(

Re: DS1307 - RTC Time Keeper

Posted: Thu Oct 31, 2013 1:26 am
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

Re: DS1307 - RTC Time Keeper

Posted: Thu Oct 31, 2013 8:28 pm
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

Re: DS1307 - RTC Time Keeper

Posted: Thu Oct 31, 2013 8:51 pm
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

Re: DS1307 - RTC Time Keeper

Posted: Sat Nov 02, 2013 8:57 pm
by Jordy101091
Hi acestu,

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

Regards Jordy

Re: DS1307 - RTC Time Keeper

Posted: Sun Nov 03, 2013 5:01 pm
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

Re: DS1307 - RTC Time Keeper

Posted: Sat Nov 09, 2013 9:03 pm
by Jordy101091
Can you clarify this a bit more,

Do you mean something of time controlled ON/OFF switch

Re: DS1307 - RTC Time Keeper

Posted: Sun Nov 10, 2013 9:54 pm
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

Re: DS1307 - RTC Time Keeper

Posted: Mon Nov 11, 2013 5:10 pm
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

Re: DS1307 - RTC Time Keeper

Posted: Mon Nov 11, 2013 6:22 pm
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

Re: DS1307 - RTC Time Keeper

Posted: Thu Nov 14, 2013 8:15 pm
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:

Re: DS1307 - RTC Time Keeper

Posted: Thu Nov 14, 2013 10:01 pm
by acestu
Hi Jordy,

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

Many Thanks
Acestu

Re: DS1307 - RTC Time Keeper

Posted: Thu Nov 14, 2013 10:14 pm
by wayne millard
Hi Jordy,

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

Thanks
Wayne :D

Re: DS1307 - RTC Time Keeper

Posted: Thu Nov 14, 2013 10:16 pm
by acestu
Hi Wayne,

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

cheers
Acestu

Re: DS1307 - RTC Time Keeper

Posted: Fri Nov 15, 2013 12:30 am
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

Re: DS1307 - RTC Time Keeper

Posted: Fri Nov 15, 2013 6:53 am
by Jordy101091
When I'm back from work today I will make a help file and a example program.

Sorry about this.

Regards Jordy