Page 4 of 6

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 6:24 pm
by acestu
Hi guys,

What am I doing wrong here :? , I have just received 2 x new RTC modules, so I wired one up and programmed the chip, but when I power on

The time says 45:85 and the date is 45/25/165

I have it wired up like so:

VCC TO +5 VOLTS
GND TO -5VOLTS
SCK TO PIN 18 OF CHIP
I/O TO PIN 23 OF THE CHIP

RST NOT CONNECTED


Is this correct ?

cheers
Acestu

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 7:23 pm
by Jordy101091
acestu wrote:Hi guys,

What am I doing wrong here :? , I have just received 2 x new RTC modules, so I wired one up and programmed the chip, but when I power on

The time says 45:85 and the date is 45/25/165

I have it wired up like so:

VCC TO +5 VOLTS
GND TO -5VOLTS
SCK TO PIN 18 OF CHIP
I/O TO PIN 23 OF THE CHIP

RST NOT CONNECTED


Is this correct ?

cheers
Acestu
I hope you did not applied a negative voltage to the GND pin of you module, I think you mean GND TO 0V.
I don't know the module youre working with but the RST and I think that is the RESET, you cannot let this hanging in the breeze. You need to make sure its a known state.

Secondly, the battery backup are u using a backup battery, with out the voltage at the battery input pin being HIGH to 3.3V or connected to Ground the DS1307 will not operate.

I hope this helps you if not let me know.

Regards Jordy

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 7:48 pm
by acestu
Hi Jordy,

Well the RTC units that I have just received are DS1302 and It looks like these are not i2c, I have also changed 2 pull up resisters on the chip i2c pins as they were not 4.7k, I connected an rtc module that I have been using a couple of months ago, now when I power up everything on the lcd is as it should be, however when I power off the board then back on the time starts from the beginning, the rtc module is a sparkfun one with only 5 pins and the only one not connected is a SQW pin, should this be connected to anything ?


cheers
Acestu

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 7:52 pm
by JohnCrow
Hi Stuart

Sorry but you have confused me slightly by saying module.

Do you mean a DS1307 (8 pin chip) or a RTC clock module that is compatible with this.

http://www.matrixmultimedia.com/mmforum ... hilit=+rtc

My old project shows how I have it wired up.
Using a 16F877A

SCL = PORT C3
SDA = PORT C4

If I remember correctly, I got that error when I first started playing with the chip, Id not connected the I2C lines to 5V with the pull-up resistors.

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 8:04 pm
by acestu
Hi John,

I only have modules with everything already on there for a hopefully functioning RTC unit, the one I have on the board at the moment I have used in another project, but now I can't get it to keep time when I power off the main supply...
RTC1.JPG
RTC1.JPG (214.77 KiB) Viewed 64277 times
RTC2.JPG
RTC2.JPG (241.04 KiB) Viewed 64277 times
cheers
Acestu

P.S. Yes Jordy the GND on the RTC module is connected to 0v

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 8:46 pm
by Jordy101091
Hi acestu,

do you still have trouble get the module from sparkfun to work properly?

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 8:52 pm
by acestu
Hi Jordy,

Everything works fine with the sparkfun module apart from keeping time, surely the battery shouldn't be flat they are supposed to last for about 9 years...

cheers
Acestu

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 8:55 pm
by Jordy101091
I know why this is happening when you power down you PIC. and the DS1307 is still running on battery power.
When you reconnect the power to the PIC the DS1307 is re-initialized and the date and time are reprogramed with the initial value you first programed.

I don't know if this is fault of the component (My side) or this has to be worked around in you own code.

Let me know what you think,

Regards Jordy

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 9:01 pm
by acestu
Hi Jordy,

I think John has built the circuit, if he has and the time keeps updating after a power recycle then it cannot be your code, I will PM John and ask him ....

cheers
Acestu

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 9:06 pm
by Jordy101091
I have updated the component to version V1.6

it now includes a property that return the Day of week as a string type.

the return format can be chosen as follow:

Number: returns a string representing the number that corresponds to the day of week so for 1 = sunday 2 = Monday and so on.
First three Chars: Sun, Mon, Tue and so on
Whole Word: Sunday, Monday, Tuesday and so on.

You can download the component ad the start post.

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 9:12 pm
by acestu
Hi Jordy,

Thanks for the new version, that's brilliant, also once I get the timer to keep time I can help you with the help documentation and or video if you require.....

cheers
Acestu

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 9:18 pm
by acestu
Hi Jordy,

Of course you are right, I need to use the eeprom in my code so that the time and date set procedure is only run once.....DOH ! :oops:

Sorry, I am only a novice


thanks
Acestu

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 9:46 pm
by JohnCrow
Hi

Just realised the same thing.
Once I re-power the PIC it runs the whole code and resets everything:)
Just commented the icons that set time and date out, with the DS1307 programmed and all works fine.

Thanks Jordy, this component is getting better all the time.

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 9:59 pm
by acestu
Hi,

I have just added the new DS1307 component and when I tried to program my chip I got this error:
compile-error.png
(10.34 KiB) Downloaded 8981 times
EDIT: John did you install the new component before you reprogrammed your chip ?

cheers
Acestu

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 10:03 pm
by JohnCrow
Hi Stuart
I got that first time

Check you are using a string in DayOfTheWeek
DS1307-TimeSwitch2-PIC.fcfx
(13.57 KiB) Downloaded 2174 times
DS1307-TimeSwitch2-PIC-no_program.fcfx
(13.67 KiB) Downloaded 2179 times


Ive tried V1.5 and V1.6

Attached are in V1.6

no program just reads the RTC

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 10:17 pm
by acestu
Hi John,

I would do but I can't open Flowcode now, I am going to reboot and try again, report back in a little while....

cheers
Acestu

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 10:59 pm
by acestu
Hi Guys,

Ok everything is working now, component is excellent now Jordy, I am enclosing my chart for those who want to have a go at this project, also if anyone wants the wiring diagram just ask in this post and I will upload one..... :D


Cheers
Acestu

Timeswitch_V1.fcfx
(14.94 KiB) Downloaded 2185 times

Re: DS1307 - RTC Time Keeper

Posted: Wed Nov 27, 2013 11:47 pm
by acestu
Hi Jordy,

Is it possible to display the seconds with this component ?

cheers
Acestu

Re: DS1307 - RTC Time Keeper

Posted: Thu Nov 28, 2013 12:06 am
by dazz
Hi Mutley
when you do a read theres an option to show seconds you need to enter 1 as a parameter

Regards
Dazz

Re: DS1307 - RTC Time Keeper

Posted: Thu Nov 28, 2013 12:27 am
by acestu
Hi Dazz,

how are you doin, (Mutley LOL)

I am just testing the timers, if you want a switch to come on every day would you set Sunday to Sunday or Sunday to Monday ? ,

I have set all ten timers with roughly 5 min intervals and tried both methods above but the timers don't come on, I will investigate further tomorrow...

cheers
Acestu

Re: DS1307 - RTC Time Keeper

Posted: Thu Nov 28, 2013 12:50 am
by dazz
Hi Stu
I thought youd like mutley :lol: , i havent got V6 on my netbook as i suspect if i started connecting boards and programming in bed wendy would kill me :lol:
as far as i can see if you wanted a timer from say 7am to 9pm i think you set it as on time 7am monday and the off time as sunday 9pm, try it like that but with a time of two or 3 minutes to test
Regards
Dazz

Re: DS1307 - RTC Time Keeper

Posted: Thu Nov 28, 2013 12:29 pm
by acestu
Hi Dazz,

Yes I will have a look when I get home, and don't you be upsetting your missus or she will cut your pocket money :lol:

cheers
Acestu

Re: DS1307 - RTC Time Keeper

Posted: Thu Nov 28, 2013 1:41 pm
by JohnCrow
I've connected the RTC to my Elektor ECIO-PLC board.

The sample program has been setup to switch the 4 relays on and off in succession.
These are working as expected

I have had to use software I2C as the lines are used on board to drive the CAN controller.
As can be seen these are on the expansion connector at the top of the board.
RE1 = Data
RE2 = Clock

However when I save and reload the flowchart the I2C connections have gone back to the default settings
C4 = Data
C3 = Clock
DS1307-TimeSwitch3-ecio- works.fcfx
(12.52 KiB) Downloaded 2082 times
PLC-RTC.jpg
PLC-RTC.jpg (53.82 KiB) Viewed 64213 times

Re: DS1307 - RTC Time Keeper

Posted: Thu Nov 28, 2013 1:49 pm
by Jordy101091
Hi john,

I need to look into the problem of the pin configuration not saving properly.
So I will investigate this when I get home, I cannot promise that I can update the component later today because I'm also busy with the T6963C component.

Regards Jordy

Re: DS1307 - RTC Time Keeper

Posted: Thu Nov 28, 2013 2:01 pm
by JohnCrow
Hi Jordy
Not keeping the pins is not too serious, everything else seems to work great.

I have had the issue Stu had with it showing on this board
The time says 45:85 and the date is 45/25/165
The problem is only there when the USB cable is connected.
I'm suspecting it is loading the 5V rail somehow and effecting the pull ups on the I2C bus. Maybe Benj can throw some light on that.
Same which ever way the ECIO power jumper is set.