Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] DS1307 code is not working

Status
Not open for further replies.
Test each module seperately like first test LCD code then test RTC and LCD code... Without OpenI2C1() your RTC will not even run.
 
Last edited:

Thanx for the reply I tested the LCD code it works fine. But still I can't find a solution for the RTCC. This is the link where I found the source code for the RTCC. They faced a similar problem too. But I can't understand what they have done to rectify it.

https://www.mikroe.com/forum/viewtopic.php?f=88&t=50564
 
Last edited:

Zip and post your Proteus file. I will check why RTC is not working. Where have you set config bits in code?
 
Last edited:
  • Like
Reactions: ADGAN

    ADGAN

    Points: 2
    Helpful Answer Positive Rating
Sorry for the late reply. I attached all the files necessary. I'm not sure whether it will compile in your PC. I set the config bits in the configuration bits window in MPLAB.

View attachment PIC18F45K22.rar
 

This is the screenshot:
SS.jpg
 

Attachments

  • PIC18F45K22 DS1307 RTC.rar
    57.7 KB · Views: 36
  • rtc.png
    rtc.png
    97.3 KB · Views: 64
  • Like
Reactions: ADGAN

    ADGAN

    Points: 2
    Helpful Answer Positive Rating
Thank you very much. I'll try this & let you know whether it works or not.
 

When you used multiple source files you have to use extern specifier for variables and functions when it is referenced or used in main file.

Edit: I saw in your project's main file that there is some code outside while(1) loop of main() function. Those code will never get executed.
 
Last edited:

Thanx. I did that on purpose. I wanted to execute only up to that part. I will change it later. Can you explain me how to use the extern specifier? I checked your code and my one. Both works. But both get late to increment time. It takes about 5 seconds to increment 1s . I think may be something to with the delays.
 

Mine increments every second. I have tested it. I have not used any delays in the code. Maybe there is delay(s) in your code. Read some C book about using extern specifier.
 

Without putting my code I used the hex file you gave me on the attachment. It takes some time (about 5s) to increment 1s. Don't know whether something wrong with the simulator but previously it worked properly. Which version of Proteus are you using?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top