I compiled this simple program reading every forum message I could find...
It is nearly working.... The display is only showing part of each byte... Could someone let me know what is wrong with the code... I have commented the result I am looking for...
'******************************************************
; set picaxe type
#picaxe 18x
'******************************************************
; set COM port used for download
#com 5
'******************************************************
i2cslave %11010000, i2cslow, i2cbyte 'set slave parameter
'******************************************************
'arbitrarily setting the clock to begin with:
' 37:14:03 03:08:10
' ss:mi:hh yy:dd:mm
'******************************************************
'b0, b1, b2, b3, b4, b5, b6, b7
writei2c 0, ($37, $14, $03, $04, $03, $08, $03, $10)
pause 500
'**************** read back the results ***************
readi2c 0,(b0,b1,b2,b3,b4,b5,b6,b7)
pause 500
let b13 = b0
gosub trans
let b13 = b1
gosub trans
let b13 = b2
gosub trans
let b13 = b3
gosub trans
let b13 = b4
gosub trans
let b13 = b5
gosub trans
let b13 = b6
gosub trans
end
trans:
b10 = b13 / $F0 + $30
b11 = b13 and $0F + $30
'**************** display the results ***************
sertxd (b10,b11,cr,lf)
return
It is nearly working.... The display is only showing part of each byte... Could someone let me know what is wrong with the code... I have commented the result I am looking for...
'******************************************************
; set picaxe type
#picaxe 18x
'******************************************************
; set COM port used for download
#com 5
'******************************************************
i2cslave %11010000, i2cslow, i2cbyte 'set slave parameter
'******************************************************
'arbitrarily setting the clock to begin with:
' 37:14:03 03:08:10
' ss:mi:hh yy:dd:mm
'******************************************************
'b0, b1, b2, b3, b4, b5, b6, b7
writei2c 0, ($37, $14, $03, $04, $03, $08, $03, $10)
pause 500
'**************** read back the results ***************
readi2c 0,(b0,b1,b2,b3,b4,b5,b6,b7)
pause 500
let b13 = b0
gosub trans
let b13 = b1
gosub trans
let b13 = b2
gosub trans
let b13 = b3
gosub trans
let b13 = b4
gosub trans
let b13 = b5
gosub trans
let b13 = b6
gosub trans
end
trans:
b10 = b13 / $F0 + $30
b11 = b13 and $0F + $30
'**************** display the results ***************
sertxd (b10,b11,cr,lf)
return