Hi all.
Has PE6 changed the way it deals with i2c code?
I thought I had it cracked last year but have just come to use some code I wrote back then and now it won't work!
I have changed to 'Read' & 'Write' commands to HI2COUT & HI2CIN but to no avail.
Thanks in advance.
Has PE6 changed the way it deals with i2c code?
I thought I had it cracked last year but have just come to use some code I wrote back then and now it won't work!
I have changed to 'Read' & 'Write' commands to HI2COUT & HI2CIN but to no avail.
Thanks in advance.
Code:
#picaxe 40X2
#no_data
#no_table
let dirsB = %11111111
symbol seconds = b0
symbol mins = b1
symbol hours = b2
symbol day = b3
symbol date = b4
symbol month = b5
symbol year = b6
symbol control = b7
HI2CSETUP i2cmaster, %1101000, i2cslow,i2cbyte
'The last bit of the DS1307 is 0 for write and 1 for read.
' Test the B port.
let outpinsB=%11111111
pause 500
let outpinsB=%00000000
main:
let seconds = %00010010
let mins = %01011001
let hours = %00100011
let day = %00000111 'Day of week. 1-7.
let date = %00110000 'Day of month. 1-31.
let month = %00010001 ' Month N?. 1-12.
let year = %00010011
let control = %10010000
'writei2c $0,(seconds,mins,hours,day,date,month,year,control)
HI2COUT $0,(seconds,mins,hours,day,date,month,year,control)
'This block reads the time.
do
HI2CIN $0,(seconds,mins,hours,day,date,month,year,control)
seconds = BcdToBin seconds
mins = BcdToBin mins
hours = BcdToBin hours
day = BcdToBin day
date = BcdToBin date
month = BcdToBin month
let outpinsB = seconds
loop
goto main