Yes thats the chip I am using... 24LC1025 and the DS1337.
The memory is net getting full already, it shows screwed up time even in the beginning !!!
Ken
Yes thats the chip I am using... 24LC1025 and the DS1337.
The memory is net getting full already, it shows screwed up time even in the beginning !!!
Ken
I mean the memory cannot be full. I am starting over each time the chip is power on and I just record a few few 'times' maybe 6 or 7. I must or ran 40 versions of this program. I cant find the problemI will use a different approach tonight
Just a thought...
Maybe being you are jumping 7 locations but writing to 3, when you go to read it is reading from locations that are empty.
Write_Address and bat are not starting from the same place?
Code:Write_Address = Write_Address +7 bat = bat + 7
Dave
Always wear safety glasses while programming.
Write_address is for recording, bat is for reading.
Lets say there are 3 reading:
first reading:
Read RTC then write at eeprom at 0
second reading:
Read RTC then write at eeprom at 7
third reading:
Read RTC then write at eeprom at 14
....
Then a show is made by putting C.7 to 0
Bat reads at 0
then bat reads at 7
then reads at 14.
...
A write is made again it is written at Write_address = 21
...
I am only using the first three anyway.
This is not the problem, the seconds for the first three reading are the same !!!!
eXAMPLE:
If I take 8 readings at 5 seconds interval, My results are that the first 3 are have the same time ie: 02:04:11 , the following 3 are: 02:04:27. last two are 02:04:38
Last edited by lerameur; - 7th December 2010 at 17:30.
Hola Dave,
I finally got the program to work like I wanted to, well almost. Its showing the same value twice. If I hit the record button. Then I hit the show button, then it will loop twice the show with the same time.. weird... it seems its doing the loop in red twice.. always.
Code:Mainloop: if PORTC.6 =0 then GOSUB READ_RTC I2CWRITE DPIN,CPIN,$A0,Write_Address,[sec,mins,hr] PAUSE 10 Write_Address = Write_Address +3 Endif if PORTC.7 =0 then if Write_Address = 0 then goto Mainloop j = 0 For i=0 to (Write_Address / 3) -1 I2CREAD DPIN,CPIN,$A0,j,[sec,mins,hr] PAUSE 10 LCDOUT $FE,1," Time ",DEC2 i LCDOUT $FE,$C0,"WA ",DEC j," T:", dec2 hr, ":", dec2 mins, ":", dec2 sec PAUSE 1000 j =j + 3 next i Endif GOTO Mainloop End READ_RTC: I2CREAD DPIN, CPIN, $D0, SecReg, [sec,mins,hr,day,date,mon,yr] pause 10 TempVal=hr GoSub BCD_TO_BIN hr=TempVal TempVal=sec GoSub BCD_TO_BIN sec=TempVal TempVal=mins GoSub BCD_TO_BIN mins=TempVal RETURN SET_RTC: ' Do once at startup yr = $3 mon = $5 date = $05 sec = $09 mins = $04 hr = $02 I2CWRITE DPIN, CPIN, $D0, SecReg, [sec,mins,hr,day,date,mon,yr] RETURN BCD_TO_BIN: ' Convert the BCD values into BIN Temp1 = $0F & TempVal ' Clear off the top four bits Temp1 = Temp1 Dig 0 Temp2 = TempVal >> 4 ' Shift down four to read 2 BCD value Temp2 = Temp2 Dig 0 TempVal = Temp2 * 10 + Temp1 Return
Last edited by lerameur; - 11th December 2010 at 15:54.
OK, I found it, changed the if then for BUTTON action with a 255 debounce cycle. works great now)
Thanks Dave for all the time you spent with me on this.
I am glad to help. Good to see you got it.
Dave
Always wear safety glasses while programming.
Bookmarks