Interfacing RTC DS 1307 to LCD Using PSoC 5lp

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

does anyone have a simple code to display a current time on LCD using external RTC DS 1307. here is i attached my project that failed to update time, i use CY8C5888LTI-LP097 . please help me. 

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Here is the DS1307 Program it was originally designed with a joy stick to move the time around on your terminal screen.  The Joystick has been removed but the program works with the DS1307.

View solution in original post

0 Likes
20 Replies
lock attach
Attachments are accessible only for community members.
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Adhic902: The DS1307 works with the I2C component. But you have no program to address the DS1307.  The Psoc 5lp will work as a clock you just need the RTC component and a WCO crystal installed on your board. On pins P15.2 and P15.3. Check the parts list for the crystal part number. If you want an DS1307 clock program I will send you one. It is for the PSOC 4 however.

0 Likes
lock attach
Attachments are accessible only for community members.
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Here is the DS1307 Program it was originally designed with a joy stick to move the time around on your terminal screen.  The Joystick has been removed but the program works with the DS1307.

0 Likes
Anonymous
Not applicable

thanks in advance Bob, for the last project u have uploaded, i just need to use I2C right? then connect the sdata and sclock part to DS1307. can u tell me how the PSoC choose the right clock resource for the RTC while there is so many resource like ILO, IMO and my external DS1307?

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Adhic902:   You just go to the configure for the I2C on the topdesign sheet and Set int to UDB and UDB clock source internal. tolerance -25 to +5. this can be checked on the .Cydwr file under clocks and then look at the  I2C clock if you double click this it will open your I2C configure screen. That's all. If you want to program the time settings write the data to the memory locations in the RTC.h the I2C function would need to be modified to do this as it is a read routine for the time currently.  Consult the Data sheet for the DS1307 for more information.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

sorry, but my current time still doesnt update. here i attached my project example from cypress and add I2C to it, please check it. thank you.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I took your project unmodified, set the target device to Cy8C5868LXI-LP035 which is the device on my PSoC5 board.

   

The seconds displayed on LCD update normally.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

may be there are mistakes on my wiring, but i think it's fine to just connect a side of SCL, SDA, VCC and Ground of my DS1307 to PSoC pin that i choose. is there any something else i forget?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I did not check I2C, I do not have got a DS1307. Your last error was "my current time still doesnt update" and that Ichecked, LCD did update.

   

I2C needs pullup resistors, do not forget.

   

 

   

Bob

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Any reason why you use an exotic clock (32kHz) for your I2C?? I would suggest you to setup I2C with "Internal clock" and 100kbit

   

 

   

Bob

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Adhic902: I looked at your 2nd program and it is not correct. You don't need the RTC component if you are using the DS1307.  Also you need the RTC.h file I sent you in the program I2C_SPI_Uart program to give you the settings for the memory of the DS1307.  Did you try this program? It works with the DS1307 I modified it to work with the PSOC 5lp. Currently I am unable to try it due to an issue with my DS1307 clock board.

0 Likes
lock attach
Attachments are accessible only for community members.
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Adhic902: Here is the program again.  Program is setup to work on PSOC 5lp board. Let me know how it works. You will need to add your display as this just works with a UART to a terminal program like PUTTY, Connect SDA to P12-1 and SCL to P12-0. UART is connected to P12-6 RX and P12-7 TX.  That's it should work just as is.

0 Likes
Anonymous
Not applicable

i have already use PUTTY, then i change the setting of your pin in the last program to resistive pull up but  PUTTY displays 00:00:80 and didnt change. i also try to make my own resistive pull up on my project board, but it still doesnt work.

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Adhic902: What DS1307 module are you using? Also are you using the Psoc 5 LP? The board doesn't have pull up resistors. So you need to add them.

0 Likes
Anonymous
Not applicable
        Tiny RTC DS1307. yes, like what i wrote on the head, i am using PSoC 5 LP (CY8C5888LTI-LP097). I have already add the pull up resistor on my project board.   
0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Adhic902: That is the same one I have and it stopped working about 2 weeks after I got the unit.  My unit displays  00:00:80.  I troubleshot the board with a scope  and determined that the DS1307 chip is not working.  It appears that the crystal input is defective or the crystal is defective.  I am going to order a new one  tomorrow and should have a new one by Monday.  I'll try the new board with the current program and let you know what is going on late Monday.  

0 Likes
Anonymous
Not applicable

I will wait for it Bob, thanks in advance.

0 Likes
Anonymous
Not applicable

don't we need just TX Bob in this case? 

0 Likes
Anonymous
Not applicable

Bob can u help to set the initial time for this? i think this program need an initial time

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

No you would need the RX on the UART to get the data to set the time. 

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

 I just ordered the DS1307 module will be here on Tuesday not Monday.

0 Likes