Ouff, ok I got it narrowed down now to one function, and I really really would like to know why it is not working. Here is the mainloop that is not working, the red part is where the differences are, The output is always FF.
Code:
Mainloop:
lcdout $FE,1, "Appuye sur Record"
lcdout $FE,$C0, "ou sur Show"
pause 100
if PORTC.6 =0 then
GOSUB READ_RTC
I2CWRITE DPIN,CPIN,$A0,Write_Address,[sec]
Write_Address = Write_Address +1
PAUSE 10
I2CWRITE DPIN,CPIN,$A0,Write_Address,[mins]
Write_Address = Write_Address +1
PAUSE 10
I2CWRITE DPIN,CPIN,$A0,Write_Address,[hr]
Write_Address = Write_Address +1
PAUSE 10
Battery_Charge_Counter = Battery_Charge_Counter + 1
Endif
if PORTC.7 =0 then
bat =0
For i=0 to 2
I2CREAD DPIN,CPIN,$A0,bat,[sec,mins,hr]
PAUSE 10
LCDOUT $FE,1," Time ",DEC3 i+1
LCDOUT $FE,$C0,"AD",DEC Write_Address,":", HEX2 hr, ":", HEX2 mins, ":", HEX2 sec
PAUSE 1000
bat = bat+3
next i
Endif
GOTO Mainloop
End
and is is the working good, looks similar, but in the none working code I need a loop.
Code:
Mainloop:
lcdout $FE,1, "Appuye sur Record"
lcdout $FE,$C0, "ou sur Show"
pause 100
if PORTC.6 =0 then
GOSUB READ_RTC
I2CWRITE DPIN,CPIN,$A0,Write_Address,[sec]
Write_Address = Write_Address +1
PAUSE 10
I2CWRITE DPIN,CPIN,$A0,Write_Address,[mins]
Write_Address = Write_Address +1
PAUSE 10
I2CWRITE DPIN,CPIN,$A0,Write_Address,[hr]
Write_Address = Write_Address +1
PAUSE 10
Battery_Charge_Counter = Battery_Charge_Counter + 1
Endif
if PORTC.7 =0 then
Write_Address = 0
I2CREAD DPIN,CPIN,$A0,Write_Address,[sec,mins,hr]
PAUSE 10
LCDOUT $FE,1," Time ",DEC3 1
LCDOUT $FE,$C0,"AD",DEC Write_Address," T:", HEX2 hr, ":", HEX2 mins, ":", HEX2 sec
PAUSE 1000
Endif
GOTO Mainloop
End
Bookmarks