Perhaps .....
DEFINE I2C_SLOW 1
..... will solve the problem?
microkam,
I can't see anything wrong with your code.
And since you are saying the EEPROM works fine
I would assume the DS1307 is faulty
(or has a bad connection)
regards
Ralph
_______________________________________________
There are only 10 types of people:
Those who understand binary, and those who don't ...
_______________________________________________
there is no faulty in ds1307 because before moment i replace the 18f452 with 16f877 on the same program and it run ok ......
i dont know whats i doing
Can you try it with a variable instead of a constant in the I2C Address... eg...
RTC var Byte
RTC=$D0
I2CWRITE DPIN,CPIN,RTC,0,[0,0,0,0,0] ' intilization of ds1307
and likewise in reading...
I2CREAD DPIN,CPIN,RTC,0,[B0] 'ds1307 read
there is no need to change between $D0 and $D1 when reading or writing, because PBP manipulates bit zero for you automatically. You only need to concern yourself with the upper seven bits of the address.
Nobody reads FAQ's... makes me wonder why I spent the time doing them in the first place...http://www.picbasic.co.uk/forum/showthread.php?t=587
i edited my programe on the new defined and the ds1307 still not working
,i download the new programe on the 16f877 and all thing is ok
whats the problem!!!
mel, can you see the new programe and tell me whats the wrong
Last edited by microkam; - 6th July 2005 at 14:39.
I interchange 18F252, 18F242, 18F2420, 18F2520 and 18F2620 with 16F876's all the time, on the same boards with a DS1307 installed (although I use different pins to you). From memory, other than CONFIG FUSES and the Weak Pull-Up's having a different Register, there's not too many other changes to look out for. Can you try another 18F PIC? what versions of PBP and MPLAB/MPASM are you using?
i used picbasic pro 2.4
microcode studio 2.0.5.2
mpasm v02.80
whats the state of fuses you use
i used HS are this correct
There are newer Versions of all the packages available.Originally Posted by microkam
(MicroCode Studio and MPASM are available for download)
With regards to the Fuses and Config Bits:
The Loader.HEX usually has all this preset, so you don't have to worry.
(As long as your programmer doesn't alter them)
regards
Ralph
_______________________________________________
There are only 10 types of people:
Those who understand binary, and those who don't ...
_______________________________________________
Melanie,
you are absolutely right in:
However,Originally Posted by Melanie
all variants listed should work:
(I would always prefer the first one)
Code:RTC CON $D0 I2CWRITE DPIN,CPIN,RTC,0,[0,0,0,0,0]Code:RTC var Byte RTC=$D0 I2CWRITE DPIN,CPIN,RTC,0,[0,0,0,0,0]and even this oneCode:I2CWRITE DPIN,CPIN,$D0,0,[0,0,0,0,0]
(Bit0 set with I2CWRITE)
works since PBP takes care of Bit0:
Code:I2CWRITE DPIN,CPIN,$D1,0,[0,0,0,0,0]
regards
Ralph
_______________________________________________
There are only 10 types of people:
Those who understand binary, and those who don't ...
_______________________________________________
Since microkam has connected the I2" lines to C.4 and C.5
and there is nothing special with PortC on the 877 or 452
it should actually be "Plug&Play"
regards
Ralph
_______________________________________________
There are only 10 types of people:
Those who understand binary, and those who don't ...
_______________________________________________
Ralph:
I have had instances (back in PBP ver 2.42) where a constant in the Device Address (eg $D0) didn't work. I've had a constant work on a 16F628, yet fail on an 16F872. Since switching to using variables, I've not experienced any problems. I've not botherd doing any in-depth studies on versions beyond 2.42 since if I don't get problems then I don't go out of my way looking for them.
Microkam:
XT for 4MHz or less, HS for greater than 4MHz.
Which sub-version of 2.4... there's big differences between say 2.40 and 2.46.
Bookmarks