Dear forum-members,
In order to read the data from my clock chip DS1307, I use the program below, including a 5-line conversion calculation (the sub called "reken") to change the clock data from hex to dec.
The program runs OK, so that's not the problem.
My question now is: is there a conversion command in the Pixcaxe programming language (that I would have overlooked) that avoids the use of my quite lengthy conversion calculation?
Thanks very much in advance for your help,
Ronald.
Here's the program:
(Picaxe 40X2)
In order to read the data from my clock chip DS1307, I use the program below, including a 5-line conversion calculation (the sub called "reken") to change the clock data from hex to dec.
The program runs OK, so that's not the problem.
My question now is: is there a conversion command in the Pixcaxe programming language (that I would have overlooked) that avoids the use of my quite lengthy conversion calculation?
Thanks very much in advance for your help,
Ronald.
Here's the program:
(Picaxe 40X2)
Code:
#no_table
#no_data
pause 1000
serout a.0, t2400,(254,128,1)
pause 200
serout a.0, t2400,(254,192,1)
pause 200
serout a.0, t2400,(254,128," ")
pause 200
serout a.0, t2400,(254,192," ")
pause 200
i2cslave %11010000,i2cslow, i2cbyte
loopje:
let b7=b0
readen:
readi2c 0, (b0)
let b8=b0
gosub reken
let b0=b11
if b0=b7 then goto readen
readi2c 0, (b0,b1,b2,b3,b4,b5,b6)
let b8=b0
gosub reken
let b0=b11
let b8=b1
gosub reken
let b1=b11
let b8=b2
gosub reken
let b2=b11
serout a.0, t2400,(254,128,#b2,"h, ",#b1,"m ")
pause 30
serout a.0, t2400,(254,192,", ",#b0,"s ")
pause 30
goto loopje
reken: 'converts hex to dec
b9=b8/16
b10=b9*16
b10=b8-b10
b11=b9*10
b11=b11+b10
return
end
Last edited by a moderator: