DS1307 - RTC Time Keeper

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

Moderator: Benj

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by dazz »

Hi
Attached is a commented flowchart which shows how to use the BST function, its quite cool watching the demo add or subtract an hour :lol:
if i have time later today i will put up a chart for the timers
Regards
Dazz
Flowcode1.fcfx
(13.28 KiB) Downloaded 1779 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

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 Dazz,

I will download now and have a look .....

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 Dazz,

It is the Timer part that I can't seem to work, do you have any ideas ?

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 »

Oke,

Here is the help file that I promised to make.
Attachments
DS1307 Help.zip
Help File V1.3
(242.69 KiB) Downloaded 1780 times
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 »

Hey thanks for doing this Jordy, much appreciated....

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 have just had another look at the component, I am only giving you some input, all commercially available time clocks usually have:

4 x on - off timed periods

They can be either

24hr which means that the on - off times will work every single day at the same time

7 day which means that you can select which day to work

5 -2 which means that you can have the on - off period different at weekends


Now consider this with your timer, if I wanted a heating system to come on at 7.00am until 8.00am then 12.00pm until 1.00pm then 4.00pm until 10.00pm every day, I would need 21 timers to do this, so there is going to have to be another parameter in there which you can set for 24HR, 5Day or 2Day

Am I making sense?
Timeclock.png
(18.97 KiB) Downloaded 9882 times
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 »

Oke I get your point.
I will have look tomorrow and update this component so the timer clock is more convenient to use.

Im now working on the part that calculates the day of week, where I use the gregorian algorithm to do this.
Hope it works in one go.

Will let you know tomorrow.

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, I wish I could help in some way, when you have finished the component perhaps I could make a video of how to use it or something similar.......

I am not up to scratch on my Gregorian Alogorythyms i'm afraid :lol:

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,

Is this any use to you:

http://www.henk-reints.nl/cal/gregcal.htm

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 »

Thanks for the tip,

I have managed to get this to work, so now you don't have to now what day of the week it is. It calculates this for you.

Anyway thanks for the tip.
I hope I can release an update tonight ore tomorrow.

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

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 »

acestu wrote:Hi Jordy,

I have just had another look at the component, I am only giving you some input, all commercially available time clocks usually have:

4 x on - off timed periods

They can be either

24hr which means that the on - off times will work every single day at the same time

7 day which means that you can select which day to work

5 -2 which means that you can have the on - off period different at weekends


Now consider this with your timer, if I wanted a heating system to come on at 7.00am until 8.00am then 12.00pm until 1.00pm then 4.00pm until 10.00pm every day, I would need 21 timers to do this, so there is going to have to be another parameter in there which you can set for 24HR, 5Day or 2Day

Am I making sense?
Timeclock.png
cheers
Acestu
I have investigated this some more and I think you are not correct, or its just me.
I only need just 3 timers just to configure you examples stated above, How do you get to a number of 21?

In you example you show that you want 3 timers:

#1 = 7.00AM to 8.00AM
#2 = 12.00PM to 01.00PM
#3 = 04.00PM to 10.00PM

All timer are active everyday of the week so this will be from Sunday to Saturday.

See the attached picture of my configuration:

Image

I hope this makes sense to you, if not I would like to hear it.

Regards Jordy

PS. If Im correct I have said that all time information for the timers needed to be entered in 24Hr notation. The reason for this is
that this notation is easier to work with in my program.
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,

No problem, I am sure you are right, after all you wrote it, I will build a circuit tonight and put it on test..............

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
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 have just started to put a chart together, however when I went to assign a digital pin to the timers they are all greyed out and nothing is selectable ?
pins.png
(18.45 KiB) Downloaded 9853 times
Have I done something wrong ?

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 »

No you haven't done anything wrong the problem is, when I assign a true ore false statement to the corresponding output pin I get a some strange error message from Flowcode when I want to test it so you cannot use the output pins at this moment.
However you can still use the return value of the Timer Update macro to activate a output (the standard way)

If you remember the TimerUpdate macro returns the following return value

255 = timer is not enabled
1 = timer is active
0 = timer is not active

Hope this helps you out, I will try to fix this problem ASAP

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

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by JonnyW »

Evening Jordy.
when I assign a true ore false statement to the corresponding output pin I get a some strange error message from Flowcode when I want to test it so you cannot use the output pins at this moment.
What is the error you are getting? Perhaps if I can replicate that here then I can help?

Cheers,

Jonny

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 put this chart togethor last night, could you have a look at it please and see if I have done it correctly ......
Heating-Timeclock.fcfx
(22.42 KiB) Downloaded 1747 times
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 »

acestu wrote:Hi Jordy,

I put this chart togethor last night, could you have a look at it please and see if I have done it correctly ......
Heating-Timeclock.fcfx
Thanks
Acestu
When I get home in will check your flowcode program

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

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 »

JonnyW wrote:Evening Jordy.
when I assign a true ore false statement to the corresponding output pin I get a some strange error message from Flowcode when I want to test it so you cannot use the output pins at this moment.
What is the error you are getting? Perhaps if I can replicate that here then I can help?

Cheers,

Jonny
The error I'm getting is some kind of syntax error.
When I get home I can tell you exactly what the error is.

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

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 »

Acestu,

I think that you have correctly build your Flowcode and it should work on your hardware.
In simulation in will not work until the injector component also processes the day of week.

if you have any question, then let me know.

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

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 »

Jonny,

This is the error message when im trying to compile my component Flowcode:

Code: Select all

Target folder: \\NASHJJAKL\Jordy Kleian\D6ULV5~V\FKZ0BJ~O\FHCR4V~2\TVVGTI~B\DS1307
Source name:   \\NASHJJAKL\Jordy Kleian\Documenten\Flowcode Projects\Flowcode v6 Componenten\Time Keeping\DS1307\DS1307.fcfx
Title:         
Description:   
Device:        PIC.16F.16F877A
Generated by:  Flowcode v6.0.3.0
Date:          Sunday, November 17, 2013 13:41:00
Users:         1
Registered to: jordy101091
Licence key:   B55ZN2
   NIET VOOR COMMERCIELE TOEPASSINGEN
http://www.matrixmultimedia.com
Fouten bij het genereren van C-code:
DS1307.c : 1954 : error : Syntaxfout
DS1307.c : 1963 : error : Syntaxfout

KLAAR
I have highlighted the calculation that produces this error, if I comment this calculation the error disappears.

Image

Tmr1Output is the variable for the output pin that the user can select.
I have PM't you the C code of the component.

Reards 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 reply, also It will be interesting to see what Jonny comes up with...... :D

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 »

I have yet released another update of the DS1307 component.

This update includes automatic calculation of the DOW (Day Of week) this value is valid up to 2199.
Also the strange behaviour is fixed whit the timer outputs so now you can use them.

It can be downloaded from the start post
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,

Now you have released your newest version, I have modified my chart to suit, could you have a look and see if you think it is right please...
Heating-TimeclockV2.fcfx
(15.4 KiB) Downloaded 1687 times
cheers
Acestu

EDIT Also I did notice this: I forgot to change the date in write date ie yesterdays date, and I received this message--
date-error.png
(8.09 KiB) Downloaded 9832 times
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
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: DS1307 - RTC Time Keeper

Post by JonnyW »

Hi Jordy.

That error may be because the pins are not connected.

The properties behave like pre-processor when converted to C. This means if you have a property called 'connection' and it is assigned to pin A 5 then what Flowcode does is take the line:
connection = 1
And replace it with:
$PORTA.5 = 1

However, if the pin is not connected Flowcode can not replace it with anything meaningful, so it sticks a zero in there instead:
0 = 1
Which is a syntax error. This is fudged during simulation and calculation entry so you can enter calculations even with unconnected pins.

If all your pins are connected OK this should work OK. If not, Flowcode should throw a warning (which you can disable via an event in each component). If the pins are connected OK and Flowcode is still producing this error you may have to PM me the source (in confidence of course) and I can see if there is an obscure bug we have not seen yet.

Jonny

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 »

acestu wrote:Hi Jordy,

Now you have released your newest version, I have modified my chart to suit, could you have a look and see if you think it is right please...
Heating-TimeclockV2.fcfx
cheers
Acestu

EDIT Also I did notice this: I forgot to change the date in write date ie yesterdays date, and I received this message--
date-error.png
This is, because you are now using the updated component V1.4 which includes auto DOW calculation you do not have to enter the Day of week you self. But in Flowcode you have used the old component where you have to specify the day of week.
Because this is not needed you have to update just that macro "WriteDate".

What you need to do is double click on that error message and you will go to the macro where this error occurred. then double click on this macro and simply select the same macro form the component list (As you normaly do). you notice that there is one line missing "DAY".

If you have done this it should work fine.

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

Post Reply