I have been "out" of Picaxe for a while but now I am back (not with a vengeance...). This is still for the "CHOOK-HOUSE" project.
I am having difficulties coding the DS1307 chip. This is what I get from Sertxd......
I have not added the minutes yet. If I do, something goes awry...........
Here is my code:
I read the RTC chip: I want the time to compare it to a stored ON time and a stored OFF time.
I have done this code to see what happens:
I want to use a time like 1830 or 2300 or 100 for 18h30/23h00/01h00 etc. 24 hr format.
What am I doing wrong ? It sure ain't easy..............
I am having difficulties coding the DS1307 chip. This is what I get from Sertxd......
The actual time is 14H00 + some minutes as w9 is showing.......b2=20t=49u=52t2=1U2=434=14w9=1400
Time=135
Chg In Scan..
b2=20t=49u=52t2=1U2=434=14w9=1400
Time=136
Chg b2=20t=49u=52t2=1U2=434=14w9=1400
Time=136
Chgb2=20t=49u=52t2=1U2=434=14w9=1400
Time=137
I have not added the minutes yet. If I do, something goes awry...........
Here is my code:
Code:
readi2c 0,(b0,b1,b2) 'READ TIME : b0=$00,b1=$15,b2=$18 = example
sertxd("b2=",#b2)
bcdtoascii b2,tens,unit
sertxd("t=",#tens,"u=",#unit)
tens=tens-48:unit=unit-48
sertxd("t2=",#tens,"U2=",#unit)
tens=tens*10+unit
sertxd("34=",#tens)
put 34,tens 'hours-not ASCII but number
w9=tens*100
sertxd("w9=",#w9,cr,lf) 'convert from eg 18 to eg 1800
put 512,w9
bcdtoascii b1,tens,unit
tens=tens-48:unit=unit-48
tens=tens*10+unit
' b1=tens*10+unit
put 35,tens 'minutes
get 512,w9 ;get Hrs * 100 eg 1800
w9=w9+tens
sertxd("Time=",#w9,cr,lf)
return
I have done this code to see what happens:
I want to use a time like 1830 or 2300 or 100 for 18h30/23h00/01h00 etc. 24 hr format.
What am I doing wrong ? It sure ain't easy..............