señores, en mi humildeopinion no puede ser mas facil conectar un 1307 a un pic siempre y cuando se haga con PBP (pic basic pro ) y la razon es que este programa ya tiene todas las librerias necesarias incluidas.
ejemplo:
rutina de programacion del 1307 a travez de un pic
memorizar:
datos = %00000000 ;segundos
addr = 0 ' Set address to 1
I2CWRITE PORTC.6,PORTC.7,cont,addr,[datos]
PAUSE 10 ' Wait 10ms for write to complete
;minutos
addr = 1 ' Set address to 2
I2CWRITE PORTC.6,PORTC.7,cont,addr,[minutos]
PAUSE 10 ' Wait 10ms for write to complete
;hora
addr =2 ' Set address to 2
I2CWRITE PORTC.6,PORTC.7,cont,addr,[hora]
PAUSE 10 ' Wait 10ms for write to complete
;hora
addr =3 ' Set address to 2
I2CWRITE PORTC.6,PORTC.7 ,cont,addr,[diasem]
PAUSE 10 ' Wait 10ms for write to complete
;dia
addr = 4 ' Set address to 1
I2CWRITE PORTC.6,PORTC.7,cont,addr,[dia]
PAUSE 10 ' Wait 10ms for write to complete
;mes
addr = 5 ' Set address to 2
I2CWRITE PORTC.6,PORTC.7,cont,addr,[mes]
PAUSE 10 ' Wait 10ms for write to complete
;year
addr = 6 ' Set address to 2
I2CWRITE PORTC.6,PORTC.7,cont,addr,[year]
PAUSE 10 ' Wait 10ms for write to complete
datos=%00000000 ;year
addr = 7 ' Set address to 2
I2CWRITE PORTC.6,PORTC.7 ,cont,addr,[datos]
PAUSE 10 ' Wait 10ms for write to complete
return
filtro:
base=0
complemento=0
base.0 = comun.4
base.1 = comun.5
base.2 = comun.6
complemento.0 = comun.0
complemento.1 = comun.1
complemento.2 = comun.2
complemento.3 = comun.3
comun = base*10+complemento
return
rutina de lectura de datos del 1307 a travez de un pic
leeclock:
addr = 0 ; segundos
I2CREAD PORTC.6,PORTC.7,cont,addr,[segundos]
comun=segundos
gosub filtro
segundos=comun
addr = 1 ; minutos
I2CREAD PORTC.6,PORTC.7,cont,addr,[minutos]
comun=minutos
gosub filtro
minutos=comun
addr = 2 ; horas
I2CREAD PORTC.6,PORTC.7,cont,addr,[hora]
comun=hora
gosub filtro
hora=comun
addr = 3 ; dia del asemana
I2CREAD PORTC.6,PORTC.7,cont,addr,[diasem]
addr = 4 ; dia
I2CREAD PORTC.6,PORTC.7,cont,addr,[dia]
comun=dia
gosub filtro
dia=comun
addr = 5 ;mes
I2CREAD PORTC.6,PORTC.7,cont,addr,[mes]
comun=mes
gosub filtro
mes=comun
addr = 6 ; año
I2CREAD PORTC.6,PORTC.7,cont,addr,[year]
return
Estas rutinas funcionan OK y son validas para la mayoria de los pic.
yo las empleo en el 16f84, el 16f873 y el 16f876.
Cordial saludo.
Daniel