I don't know anything about that simulator, but that code seems to work fine in the Proteus Simulator with a 16F88.
What chip are you using?
![]()
I don't know anything about that simulator, but that code seems to work fine in the Proteus Simulator with a 16F88.
What chip are you using?
![]()
DT
I'm using a 16F690. I have never used any rtc's at all so don't know if my simulator will do this. It does have a rtc ds1307 in it though. My simulator is keeping time off the computers time.This is my chip set up:
Code:TRISC = %00000000 TRISB = %00000000 TRISA = %000000 CM1CON0.7 = 0 ' Comparators = off CM2CON0.7 = 0 ' Comparators = off ANSEL = %00000000 ANSELH = %00000000
Last edited by mel4853; - 6th January 2013 at 23:53.
The code specifies PORTB.0 and PORTB.1 as SDA and SCL.
But the 16F690 doesn't have either RB0 or RB1, it only has RB4-RB7.
What pins are the DS1307 connected to in your simulation?
DT
SDA to PORTA.0 & SCL to PORTA.1 sorry forgot to post that also.
Using a 16F690 with the changes you posted ... It still works.
I can't comment on the simulator you are using.
But I think you can assume the problem is not in Bruce's code.
![]()
DT
Thanks Darrel really thought it was my simulator, now I know that. Thanks again, will look more into how this works with my simulator or if I'm just SOL.
Some simulators wont set the time automatically to system time, Ive run into this in the past, but just have your PIC chip check the time on startup and if it's all 0s, have it set the time through the code to a certain time or date. They do that for more realistic hardware, just like as if you were to hook up a blank ds1307 chip up and just started using it.
Bookmarks