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] Time update problem with DS1307 + pic18f25k22

Status
Not open for further replies.

ltsharma

Advanced Member level 4
Full Member level 1
Joined
May 26, 2013
Messages
110
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,306
Location
banglore
Visit site
Activity points
2,003
Hello,

I'm using PIC18f24K22 (16MHZX4PLL = 64MHZ) and given i2c frequency 1000000, Compailer mikroC, used 10K pullup for SCL & SDA

I did Circuit connection with DS1307 on hardware as in datasheet, its showing time, and also saving last time, but its not updating, what time we sets, hold that time only, not even seconds is moving, what may be the problem?
 

i did setting time with hardware (buttons) and used software both, no use.
im doing it on circuit, no Proteus file :(

MikroC -
 

Attachments

  • DS1307.rar
    46.9 KB · Views: 107

is i need to remove /* */ this thing (comment indicator) in that code ????

- - - Updated - - -

no, remains same, no change :(
 

here Proteus file and mikrC -

but it works in Proteus with i2c debugger,
Proteus not runs properly with 4xPLL (64mhz),
 

Attachments

  • DS1307.rar
    106.3 KB · Views: 119

I know it works. I had tested it in Proteus. The problem is in hardware. Change pullups on I2C bus to 4.7k. Why are you using 64 MHz? See if it works with 4 MHz Crystal. Are you testing on breadboard? If yes then you can't use 16 MHz and above clock while using breadboard.
 
yes.. its working with 16mhz, but not working with PLL, is there any solution for running DS1307 at 64MHZ?
I'm using 64mhz because it will become fster. isn't it?

- - - Updated - - -

nooo.. im having 2 DS1307s, one is not saving time another not updating time..
 

I'm using 64mhz because it will become faster. isn't it?

Once you set the time then DS1307 seconds register increment once every second and if you read the DS1307 twice every second then it is more than enough. In Compiler check how many ms it takes to execute the while(1) loop once. It will be in ms even if you use 4 MHz Fosc. So, you will be reading DS1307 more than once every second. Use Fosc = 4 MHz and without PLL.

I think you can't use more than one DS1307 on the same I2C bus because the device address will be the same. The device doesn't have options to set different address.

Also there is no use of using more than one DS1307 in the same circuit as the time of both DS1307 will be same.
 

Post your exact hardware circuit. There is nothing to do with Fosc and DS1307. DS1307 runs independently. Fosc is for the uC. Why do you need 64 MHz Clock? Use 4 MHz. The DS1307 comunicate through I2C with the I2C frequency you have set, may be 1 MHz in your code. If you use 16 MHz or 4 MHz or 64 MHz it doesn't change the I2C communication frequency.
 
Last edited:

im having lot of things to execute in one cycle, more than 5 ADC values, 500ms delay for speed counting, so many calculations, so i choosed 16mhz crystal (i thought its best suited crystal for faster cycles), is there nothing to do with 16MHz crystal?, and also im having 4MHz crystal, is i need to use that only?
and my doubt is why those 2 DS1307 ics are doing like that? >one is not holding time (updating) and another is not updating (saving)???
 

no im having only one DS1307 in circuit, another is spear,and i used 32.xx crystal and 3v battery only
 

View>Debug Windows>Stop Watch

Then Run>Start Debug
Execute till start of while(1) loop and then clear stop watch and then step over through instructions in while(1) till execution returns to beginning of while(1) loop again. Note down stop watch timing. Do this for different clocks. Time will be in ms if you don't have delays in while(1) loop. If you need delays i while(1) loop then use timers.
 

ohhh.. its another problem,

used 4MHz crystal, updating and saving, but time is falling behind, running slow..
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top