-
PBP3 and DS1307
Hello
I have a problem with PBP3 compiler.
I make a little program on PIC12F1840 with intern oscillator at 16MHz.
I connect a DS1307 and I use only internal I2C Ram.
I made a first test :
test_ram:
'Writing RAM $08 -> $3F
ram_erreur=0
for l=0 to 255
for k=08 to $3F 'writing ram
i2cwrite sda,scl,$D0,k,[l]
next k
for k=08 to $3F 'reading ram
i2cread sda,scl,$D0,k,[m]
if m<>l then
ram_erreur=1
endif
led2=!ram_erreur
next k
next l
goto test_ram
For values of "L" between $00 to $7F, Iam reading the value writen befor but for values of "L" between $80 to $FF, I am reading the value with the 7's bit=0 so, 80 ->00, $81 ->$01, ... $FF -> $0F.
I dont see error in my little code.
Could you help me ??
Best regards
Marc
-
Re: PBP3 and DS1307
The part is only 64 bytes. According to the data sheet:
The RTC registers are located in address locations 00h to 07h. The RAM registers are located in address locations 08h to 3Fh. During a multibyte access, when the address pointer reaches 3Fh, the end of RAM space, it wraps around to location 00h, the beginning of the clock space.
Which is why you see what you see when you try to access data greater that 64 bytes (0x3F).
-
Re: PBP3 and DS1307
Hello
Yes of course but it's correct for my device.
I found my error.
The adress pointer was a word but not a byte and the compiler accept and the DS1307 works bad.
Best regards
Marc