Autor Tema: Reloj y Termomero ( DS1307 Y DS1820)  (Leído 2427 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado Noelillo

  • PIC12
  • **
  • Mensajes: 94
Reloj y Termomero ( DS1307 Y DS1820)
« en: 16 de Febrero de 2014, 14:28:02 »
Código: [Seleccionar]
'****************************************************************
'*  Name    : RelTerm.BAS                                       *
'*  Author  : Miguel Noe Garcia Perez                           *
'*  Notice  : Copyright (c) 2010 Iberica 2000                   *
'*          : All Rights Reserved                               *
'*  Date    : 09/03/2010                                        *
'*  Version : 1.0                                               *
'*  Notes   : Reloj Termometro el circuito del reloj es el      *
'*          : DS1307 Y el termometro el DS1820                  *
'*  NO FUNCIONA CON EL DS18B20                                  *
'****************************************************************
 
        Device 16F876
        XTAL = 4
' LCD pin Configuracion
        lcd_type = 0
        LCD_LINES = 4
        LCD_DTPIN = PORTb.4
        LCD_RSPIN = PORTb.3
        LCD_ENPIN = PORTb.2
        LCD_INTERFACE = 4
       
       
       
         PORTB_PULLUPS = ON              ' Enable PORTB pull-ups 
         SCL_PIN = PORTC.3
         SDA_PIN = PORTC.4   
       
'***************************************************************************************
        Cls      ' Clear LCD
        ALL_DIGITAL = True ' Set ports to digital mode
        Clear ' Clear buffers
'******************************************************************************************
'*********************  SIMBOLOS DEL PROGRAMA *********************************************
'******************************************************************************************
    Symbol DQ = PORTB.1 ' Pin de conexión 1-Wire®
    Symbol Seg  = 0 ' Registro de Seg.
    Symbol Minu = 1 ' Registro de Min.
    Symbol Hora = 2 ' Registro de Horas
    Symbol Dia  = 3 ' Registro de Día
    Symbol Dias = 4 ' Registro de Día
    Symbol Mes  = 5 ' Registro de Mes
    Symbol Ano  = 6 ' Registro de Año
    Symbol Control = 7
    Symbol SW1    =    PORTb.4 ' Interruptor Set
    Symbol SW2    =    PORTB.5 ' Interruptor Incre
    Symbol SW3    =    PORTB.6 ' Interruptor Intro
    'Symbol SW4    =    PORTB.7 ' Interruptor Extra
    symbol LDR     =    porta.4 ' sensor luz
    symbol LcdLed  =    porta.0 ' LCD LED
    symbol LedRojo =    portc.7
    symbol LedVerde=    portc.6
    symbol Zumbador=    portc.2 ' Zumbador.
   






'*******************************************************************************************
'*************************** VARIABLES A$ **************************************************
'*******************************************************************************************
    Dim Index As Byte        ' Variable de uso general
    Dim ROMCODE[8] As Byte   ' Arreglo almacena el serial
    Dim SERIAL[8] As Byte    ' Arreglo almacena serial
    Dim X As Word
    Dim Contador As Word
    Dim TEMPERATURA As Word  ' Variable alm. temperatura
    Dim FL_TEMP As Float     ' Variable alm. temperatura
     'Dim FL_TEMP As word    ' Variable alm. temperatur

    DIM Cifra as byte 
    Dim Sign as Byte
    Dim Cnt as Byte
    Dim Count_Per_Deg as Byte
    Dim Temp as Word
    Dim Temp_Dec as Byte
    DIM Puntero AS BYTE


    Dim RTC[8] As Byte ' Vector almacenamiento
    'Dim Index As Byte ' Variable uso general
    dim Btnvar     as byte ' Pulsadores
    dim Horas   as byte
    dim Minutos as Byte
    dim Day     As Byte
    dim Days    As Byte
    dim Meses   As Byte
    Dim Anos    As Byte
    dim Memo    as Byte
    dim Llena   as Byte
   
    dim Direccion as word
    dim Dire      as word
    dim Dato1     as word
    dim Dato2     as word
    dim Dato3     as word
    dim Dato4     as word
    dim Dato5     as word
    'dim Dato6     as word
    'dim Dato7     as word
   
    dim Conta     as byte
    dim Conta2    as byte
    dim Conta3    As Byte
    dim Valor     as word
    'dim Resul     as word
    dim Panta     as byte
   
    Dim N         as Byte
    dim Mode      as byte
    dim HorasMemo as byte
Dim W0 as Word                    ' Address
Dim B1 as Byte                    ' Data 1
Dim B2 as Byte                    ' Data 2
Dim B3 as Byte                    ' Data 1
Dim B4 as Byte                    ' Data 2
' memo = 0
' memo = memo +1
' 'Ewrite 0,[memo]

direccion = $00
Conta     = 0
conta2    = 1
llena     = 0
 GoSub RTC_INI
 gosub FECHA_INI
'
 
'**************************************************************************************
'************************* P R E S E N T A C I O N ************************************
'**************************************************************************************
low LcdLed   
high zumbador     
                     ' 1234567890123456
         Print at 1,3,"Otro Invento"
         Print at 2,3,"de Miguelito"                         
low zumbador
for n=0 to 3
 high ledrojo
  delayms 200
 low ledrojo
  delayms 20
 high ledVerde
  delayms 200
 low ledverde
next

         
         Delayms 2000
CLS
high zumbador
   '           1234567890123456
         Print at 1,1,"Reloj Termometro"
         Print at 2,8,"V1.2"
low zumbador                       
         Delayms 2000
         cls


'**************************************************************************************

N =   EREAD 0                  'Lee Memoria Pic
if n = $FF then goto ProgReloj 'Si no hay nada grabado (FF) Va a programar Reloj

'**************************************************************************************
'******************************* INICIO PROG ******************************************
'**************************************************************************************

MAIN:
    low ledrojo
    low ledverde
    if Ldr = 1 then low  LcdLed
    if ldr = 0 then high LcdLed
   
   
    button sw1,0,255,250,Btnvar,0,NoPulso
           goto ProgReloj
NoPulso:
     button sw2,0,255,250,Btnvar,0,NoPulso2
           goto leerGrabacion   
NoPulso2:   
    GoSub Conversion   ' Rutina convertir Temperatura
    GoSub Mostrar      ' Rutina mostrar los valores
    gosub NumeroGrande
    Gosub Reloj
    GoTo Main

'*****************************************************************
Conversion:
    OWrite DQ,1,[$CC,$44] ' Comando Convertir Temp
    High DQ ' DQ en alto por 750 ms
'******************* Tiempo de Conversion ************************
    OWrite DQ,1,[$CC,$BE] ' Comando leer SCRATCHPAD.
    OREAD DQ,2,[Temp.LOWBYTE,Temp.HIGHBYTE,Cnt,Cnt,Cnt,Cnt,Cnt,Count_Per_Deg] 'Lee el scratchpad
    Return

Mostrar:
    Temp_Dec = (6.25 * Cnt)
    'Signo:   
   If Temp.8=1 Then
    Temp=(Temp.LowByte ^ $FF) >> 1
   If Cnt = 0 then Temp = Temp + 1
    Sign = "-"
   Else
    Temp=(Temp >> 1)
    Sign = " "             
    Temp_Dec = 100 - Temp_Dec                             
   Endif
Return
   cls
'**************************************************************
Reloj:
    GoSub LEER_RTC    ' Leer registros RTC
    GoSub MOSTRAR_RTC ' Mostrat registros RTC
    gosub LoGrabo
    gosub SelecDia
return
'*************************************************************
RTC_INI:
    BusIn $D1,0,[RTC[Seg]]        ' Lee byte 0, RTC
    BusOut $D0,0,[RTC[Seg] & $7F] ' Pone 0 en bit CH
Return                            ' Para Activar RTC
'*************************************************************     
FECHA_INI:
    RTC[Seg] =   $00 ' Ajusta los Seg. iniciales
    RTC[Minu]=   EREAD 1' Ajusta los Min. iniciales
    RTC[Hora]=   EREAD 0' Ajusta la Hora inicial
    RTC[Dia] =   eread 5' Ajusta el Día inicial
    rtc[Dias]=   eread 2' Ajuste del dia lunes Martes
    RTC[Mes] =   eread 3' Ajusta el Mes inicial
    RTC[Ano] =   eread 4' Ajusta el Año inicial
    rtc[Control]=$10 ' Ajunte Reg Control
BusOut $D0,0,[Str RTC\8] ' Escribe registros RTC
Return
'***********************************************************
LEER_RTC:
    For Index = 0 To 6
        BusIn $D1,Index,[RTC[Index]] ' Lee registros
    Next ' del RTC 0..6
Return
'***********************************************************
LoGrabo:
if Llena = 1 then  high ledRojo: return
if RTC[Hora] = $00 and  conta  = 0 then gosub OtroDia
if rtc[Hora] = $01 then conta  = 0
if RTC[minu] = $00 and  Conta2 = 0 then Gosub Graba
if RTC[minu] = $01 then conta2 = 0
return
'***********************************************************
MOSTRAR_RTC:
    print at 1,9,hex2 RTC[Hora], ":", hex2 RTC[Minu],":", hex2 RTC[Seg]
    print at 2,9,hex2 RTC[Dias], "/", hex2 RTC[Mes],"/", hex2 RTC[Ano]
    days = rtc[Dia]
    Dato1 = RTC[2]
    Dato2 = RTC[1]
    Dato3 = RTC[4]
    Dato4 = RTC[5]
    Dato5 = RTC[6]
'******************* graba datos en la Memoria del pic   
 Ewrite 0,[RTC[2]]
 Ewrite 1,[RTC[1]]
 Ewrite 2,[RTC[4]]
 Ewrite 3,[RTC[5]]
 Ewrite 4,[RTC[6]]
 Ewrite 5,[RTC[3]]
 
return
'******************* Selecciona Dia de la semana
SelecDia:
 'days = rtc[4]   
    select days
        case 1     
        print at 1,6,"Lu"
        case 2     
        print at 1,6,"Ma"
        case 3      '23456
        print at 1,6,"Mi"
        case 4      '23456
        print at 1,6,"Ju"
        case 5      '23456
        print at 1,6,"Vi"
        case 6      '23456
        print at 1,6,"Sa"
        case 7      '23456
        print at 1,6,"Do"
    end select
   
    'print at 3,1,"DIAS:", dec2 rtc[Dias]
Return
'******************* Codigo BCD ***************************************
BCD2BIN:
    For Index = 0 To 6
    RTC[Index] = (RTC[Index]/16)*10 + RTC[Index] & $0F
    Next
Return
'******************** Codigo BCD ***************************************
'******************** Graba Datos en Memoria **************************
Graba:
 high ledRojo
 conta2 = 1
 BSTART
 busout $A0,Direccion,[temp.lowbyte,Temp_Dec.lowbyte]
 BSTOP
 Delayms 10
 inc Direccion ' Incrementa
 inc Direccion ' 2 Posiciones
 if  Direccion >= 32760 then gosub Memo1
 low ledRojo
 cls
Return
'******************** Memo1 *******************************************
Memo1:
cls          '1234567890123456
print at 1,1,"Modulo de Memori"
print at 2,4,"(A) lleno"
delayms 2000
Llena = 1     
high ledrojo
return
'*********************************************************************
OtroDia:
    'gosub LEER_RTC
    Dato3 = RTC[4]
    Dato4 = RTC[5]
    Dato5 = RTC[6]
    cls
    high ledVerde
    gosub sonido2
    print at 1,5,"Otro dia"
    delayms 1500
    low ledverde
    conta = 1
    Conta2= 0
    'cls
    busout $A0,Direccion,[dato3.lowbyte,dato4.lowbyte,dato5.lowbyte]   
     gosub LedInter
     gosub LedInter
     direccion = direccion + 3
     'gosub graba
Return
'******************** Led Inter ***************************************
LedInter:
 for n=0 to 5
    high ledRojo
     delayms 99
      low ledrojo
     delayms 99
 next n
Return
'************************** Leer Grabacion ****************************
leerGrabacion:
Gosub Sonido2
high ledrojo
cls
print at 1,1,"Buscar DATOS"
delayms 1000
cls
'*************************************************
DiaSetD:
gosub sonido2
If day >=$32 then day = $01
if day = $0A then day = day + $6
if day = $1A then day = day + $6
if day = $2A then day = day + $6
if day = $3A then day = day + $6
print at 2,7,hex2 day
print at 1,5,"- DIA -"
NoPress57D: button sw2,0,255,250,Btnvar,0,NoPress17D
           goto ProDiaD': print at 1,1,"Programar Riego"                       
NoPress17D: button sw1,0,255,250,Btnvar,0,NoPress57D
           inc day:delayms 200:goto DiaSetD

ProDiaD:
Gosub sonido3
cls
'**************************************************
MesSetD:
gosub sonido2
If meses >=$13 then meses = $01
if meses = $0A then meses = meses + $6
if meses = $1A then meses = meses + $6
print at 1,5,"- MES -"
print at 2,7,hex2 meses
NoPress58D: button sw2,0,255,250,Btnvar,0,NoPress18D
           goto ProMesD': print at 1,1,"Programar Riego"                       
NoPress18D: button sw1,0,255,250,Btnvar,0,NoPress58D
           inc meses:delayms 200:goto MesSetD
ProMesD:
Gosub sonido3
cls
'****************************************************
AnosSetD:
gosub sonido2
If anos >=$49 then anos = $00
if anos = $0A then anos = anos + $6
if anos = $1A then anos = anos + $6
if anos = $2A then anos = anos + $6
if anos = $3A then anos = anos + $6
print at 1,5,"- A",238,"O -"
print at 2,5,"20",hex2 anos
NoPress59D: button sw2,0,255,250,Btnvar,0,NoPress19D
           goto ProanoD                     
NoPress19D: button sw1,0,255,250,Btnvar,0,NoPress59D
           inc anos:delayms 200:goto AnosSetD
'****************************************************
ProAnoD:
Gosub sonido3
cls
high ledrojo
high ledverde
gosub sonido2
print at 1,1,"Buscando..."
for W0=0 to 32760 step 51
Busin $A1,W0,[B1.lowbyte,b2.lowbyte,b3.lowbyte]
if B1= Day and b2= meses and b3= Anos then Goto Load
print at 2,1,"Posicion: ",dec5 w0
next w0
delayms 500
cls
Gosub sonido3
print at 1,1,"No Hay Datos"
delayms 1000
cls
low ledrojo
low ledverde
GoTo MAIn
'***************************************************
Load:
cls
gosub sonido2
print at 1,1,"Datos Encontrados"
print at 2,1,"Posicion: ",dec5 w0
delayms 2000
cls
w0=w0 + 3
HorasMemo = 0
'**************************************************
OtroDato:
 if HorasMemo > 23 then HorasMemo=0:W0 = W0 - 48
 gosub sonido2
 Busin $A1,W0,[B1.lowbyte,b2.lowbyte]
 print at 1,9,dec2 HorasMemo, ":00:00"
 print at 2,9,dec2 Day, "/",dec2 Meses,"/",dec2 Anos
 print at 1,5,"W0",dec2 W0
 Temp     = B1
 Temp_dec = b2
gosub NumeroGrande
 w0= w0 +2
NoPress59Di: button sw2,0,255,250,Btnvar,0,NoPress19Di
             delayms 200:cls:goto MAIN                       
NoPress19Di: button sw1,0,255,250,Btnvar,0,NoPress59Di
             inc HorasMemo:delayms 200:goto OtroDato

'**********************************************************************
'************************* programar RELOJ ****************************
'**********************************************************************
ProgReloj:
high ledVerde
gosub Sonido1

Cls          '1234567890123456
print at 1,4,"Prog.Reloj"
delayms 1000
cls
Horas = RTC[Hora]
'****************************************************
HoraSet:
gosub sonido2
If Horas >=$24 then Horas = 00
if horas = $0A then horas = horas + $6
if horas = $1A then horas = horas + $6
print at 1,5,"- HORA -"
print at 2,8,hex2 Horas
 
NoPress55: button sw2,0,255,250,Btnvar,0,NoPress15
           goto Prohora': print at 1,1,"Programar Riego"                       
NoPress15: button sw1,0,255,250,Btnvar,0,NoPress55
           inc horas:delayms 200:goto HoraSet
cls
'******************************************************
Prohora:
Gosub sonido3
BusOut $D0,2,[horas] ' Escribe registros RTC
delayms 200
Minutos = RTC[Minu]   
cls
'*****************************************************
MinuSet:
gosub sonido2
If Minutos >=$5A then Minutos = $00
if Minutos = $0A then Minutos = Minutos + $6
if Minutos = $1A then Minutos = Minutos + $6
if Minutos = $2A then Minutos = Minutos + $6
if Minutos = $3A then Minutos = Minutos + $6
if Minutos = $4A then Minutos = Minutos + $6
print at 2,8,hex2 Minutos
print at 1,4,"- MINUTOS -"

NoPress56: button sw2,0,255,250,Btnvar,0,NoPress16
           goto Prominuto': print at 1,1,"Programar Riego"                       
NoPress16: button sw1,0,255,250,Btnvar,0,NoPress56
           inc Minutos:delayms 200:goto minuSet
'****************************************************           
Prominuto:
Gosub sonido3
BusOut $D0,1,[minutos] ' Escribe registros RTC 
delayms 200
day = RTC[Dias]
cls
'***************************************************
DiaSet:
gosub sonido2
If day >=$32 then day = $01
if day = $0A then day = day + $6
if day = $1A then day = day + $6
if day = $2A then day = day + $6
if day = $3A then day = day + $6
print at 2,7,hex2 day
print at 1,5,"- DIA -"
NoPress57: button sw2,0,255,250,Btnvar,0,NoPress17
           goto ProDia': print at 1,1,"Programar Riego"                       
NoPress17: button sw1,0,255,250,Btnvar,0,NoPress57
           inc day:delayms 200:goto DiaSet
'***************************************************
ProDia:
Gosub sonido3
BusOut $D0,4,[day] ' Escribe registros RTC 
delayms 200
meses = RTC[Mes]
cls
'***************************************************
MesSet:
gosub sonido2
If meses >=$13 then meses = $01
if meses = $0A then meses = meses + $6
if meses = $1A then meses = meses + $6
print at 1,5,"- MES -"
print at 2,7,hex2 meses
NoPress58: button sw2,0,255,250,Btnvar,0,NoPress18
           goto ProMes': print at 1,1,"Programar Riego"                       
NoPress18: button sw1,0,255,250,Btnvar,0,NoPress58
           inc meses:delayms 200:goto MesSet
'***************************************************
ProMes:
Gosub sonido3
BusOut $D0,5,[meses] ' Escribe registros RTC 
delayms 200
anos = RTC[Ano]
cls
'***************************************************
AnosSet:
gosub sonido2
If anos >=$49 then anos = $00
if anos = $0A then anos = anos + $6
if anos = $1A then anos = anos + $6
if anos = $2A then anos = anos + $6
if anos = $3A then anos = anos + $6
print at 1,5,"- A",238,"O -"
print at 2,5,"20",hex2 anos
NoPress59: button sw2,0,255,250,Btnvar,0,NoPress19
           goto Proano': print at 1,1,"Programar Riego"                       
NoPress19: button sw1,0,255,250,Btnvar,0,NoPress59
           inc anos:delayms 200:goto AnosSet
'***************************************************
ProAno:
Gosub sonido3
BusOut $D0,6,[anos] ' Escribe registros RTC 
delayms 200
Days = 1 'RTC[Dia]
gosub Selecdia
cls
'**************************************************
DiasSet:
gosub sonido2
If days >=$8 then days = $01

print at 2,1,"DIA DE LA SEMANA"
gosub SelecDia
NoPress60: button sw2,0,255,250,Btnvar,0,NoPress20
           goto ProDias': print at 1,1,"Programar Riego"                       
NoPress20: button sw1,0,255,250,Btnvar,0,NoPress60
           inc days:delayms 200:goto DiasSet
'**************************************************
ProDias:
Gosub sonido3
RTC[Dia] = Days
BusOut $D0,3,[days] ' Escribe registros RTC 
delayms 200
cls
low ledverde
goto main
'***********************************************************************************
'************** SONIDOS *************** DEL ********* ZUMBADOR *********************
'***********************************************************************************
Sonido1:
    high Zumbador
    delayms 20
    low Zumbador
    delayms 100
    high Zumbador
    delayms 40
    low Zumbador
return
'*************************** 
Sonido2:
    high Zumbador
    delayms 10
    low Zumbador
return
'***************************     
Sonido3:
    high Zumbador
    delayms 60
    low Zumbador
return
'**************************     
Sonido4:
    high Zumbador
    delayms 5
    low Zumbador
return     
'**************************************************************************************
'********* TODO ESTO ES DE MI AMIGO TRIGO TODOS LOS DERECHOS SON DE TRIGO *************
'**************************************************************************************
NumeroGrande:
'PRIMERO IMPRIMIMOS LAS DECENAS
   
    Cifra = dig temp, 1     'Decenas de grado.
    Puntero = 64            'Primer carácter de la CGRAM, numerado como 0
    Gosub Que_cifra
'    print AT 1,10, 0,1
'    print AT 2,10, 2,3
    print AT 1,1, 0,1
    print AT 2,1, 2,3
   
    'Y A CONTINUACIÓN LAS UNIDADES
       
    Cifra = dig temp, 0     'Unidades de grado.
    Puntero = 96            'Quinto carácter de la CGRAM, numerado como 4
    Gosub Que_cifra
    print AT 1,3, 4,5
    print AT 2,3, 6,7, ".",Dec2 Temp_Dec, 223 'el 223 es el símbolo de grado
    'print AT 2,12, 6,7, ".",Dec DIG Temp_Dec, 1, 223 'el 223 es el símbolo de grado
    return   
       
        Que_cifra:
           
            select Cifra.
                case 0: gosub cero: RETURN      'Rutinas para crear los gráficos correspondientes a esas cifras en gran formato
                CASE 1: GOSUB UNO: RETURN
                CASE 2: GOSUB DOS: RETURN
                CASE 3: GOSUB TRES: RETURN
                CASE 4: GOSUB CUATRO: RETURN
                CASE 5: GOSUB CINCO: RETURN
                CASE 6: GOSUB SEIS: RETURN
                CASE 7: GOSUB SIETE: RETURN
                CASE 8: GOSUB OCHO: RETURN
                CASE 9: GOSUB NUEVE: RETURN
            ENDSELECT
           
           
    'CARGANDO LOS CARACTERES PERSONALIZADOS EN LA CGRAM
   
   
   
CERO:
    'SI:
        Print 254,Puntero,$07,$0F,$1C,$18,$18,$18,$18,$18
    'SD:
        Print 254,Puntero + 8,$18,$1C,$0E,$06,$06,$06,$06,$06
    'II:
        Print 254,Puntero + 16,$18,$18,$18,$18,$18,$1C,$0F,$07
    'ID:
        Print 254,Puntero + 24,$06,$06,$06,$06,$06,$0E,$1C,$18
       
    RETURN
   
   
UNO:                   
    'SI:
        Print 254,Puntero,$00,$00,$00,$01,$01,$00,$00,$00
    'SD:
        Print 254,Puntero + 8,$0C,$1C,$1C,$1C,$1C,$0C,$0C,$0C
    'II:
        Print 254,Puntero + 16,$00,$00,$00,$00,$00,$00,$00,$00
    'ID:
        Print 254,Puntero + 24,$0C,$0C,$0C,$0C,$0C,$0C,$1E,$1E
       
    RETURN
   
DOS:
    'SI:
        Print 254,Puntero,$07,$0F,$1C,$18,$00,$00,$00,$00
    'SD:
        Print 254,Puntero + 8,$18,$1C,$0E,$06,$06,$06,$0E,$1C
    'II:
        Print 254,Puntero + 16,$01,$03,$07,$0E,$1C,$18,$1F,$1F
    'ID:
        Print 254,Puntero + 24,$18,$10,$00,$00,$00,$00,$1E,$1E
    RETURN
   
TRES:
    'SI:
        Print 254,Puntero,$07,$0F,$1C,$18,$00,$00,$01,$01
    'SD:
        Print 254,Puntero + 8,$18,$1C,$0E,$06,$06,$0E,$1C,$18
    'II:
        Print 254,Puntero + 16,$00,$00,$00,$18,$18,$1C,$0F,$07
    'ID:
        Print 254,Puntero + 24,$1C,$0E,$06,$06,$06,$0E,$1C,$18
    RETURN
   
CUATRO:
    'SI:
        Print 254,Puntero,$00,$00,$01,$01,$03,$03,$07,$06
    'SD:
        Print 254,Puntero + 8,$1C,$18,$18,$10,$10,$00,$00,$00
    'II:
        Print 254,Puntero + 16,$0E,$0C,$1C,$1F,$1F,$00,$00,$00
    'ID:
        Print 254,Puntero + 24,$0C,$0C,$0C,$1E,$1E,$0C,$0C,$0C
    RETURN
   
CINCO:
    'SI:
        Print 254,Puntero,$1F,$1F,$18,$18,$18,$18,$1F,$1F
    'SD:
        Print 254,Puntero + 8,$1E,$1E,$00,$00,$00,$00,$18,$1C
    'II:
        Print 254,Puntero + 16,$00,$00,$00,$00,$18,$1C,$0F,$07
    'ID:
        Print 254,Puntero + 24,$0E,$06,$06,$06,$06,$0E,$1C,$18
    RETURN
   
SEIS:
    'SI:
        Print 254,Puntero,$07,$0F,$1C,$18,$18,$18,$1B,$1F
    'SD:
        Print 254,Puntero + 8,$18,$1C,$0E,$06,$00,$00,$18,$1C
    'II:
        Print 254,Puntero + 16,$1C,$18,$18,$18,$18,$1C,$0F,$03
    'ID:
        Print 254,Puntero + 24,$0E,$06,$06,$06,$06,$0E,$1C,$18
    RETURN
   
SIETE:
    'SI:
        Print 254,Puntero,$1F,$1F,$00,$00,$00,$00,$00,$01
    'SD:
        Print 254,Puntero + 8,$1E,$1E,$06,$0E,$0C,$1C,$18,$18
    'II:
        Print 254,Puntero + 16,$01,$03,$03,$07,$06,$0E,$0C,$0C
    'ID:
        Print 254,Puntero + 24,$10,$10,$00,$00,$00,$00,$00,$00
    RETURN
   
OCHO:
    'SI:
        Print 254,Puntero,$07,$0F,$1C,$18,$18,$1C,$0F,$0F
    'SD:
        Print 254,Puntero + 8,$18,$1C,$0E,$06,$06,$0E,$1C,$18
    'II:
        Print 254,Puntero + 16,$1C,$18,$18,$18,$18,$1C,$0F,$03
    'ID:
        Print 254,Puntero + 24,$0E,$06,$06,$06,$06,$0E,$1C,$18
    RETURN
   
NUEVE:
    'SI:
        Print 254,Puntero,$07,$0F,$1C,$18,$18,$18,$18,$1C
    'SD:
        Print 254,Puntero + 8,$18,$1C,$0E,$06,$06,$06,$06,$0E
    'II:
        Print 254,Puntero + 16,$0F,$07,$00,$00,$18,$1C,$0F,$07
    'ID:
        Print 254,Puntero + 24,$1E,$16,$06,$06,$06,$0E,$1C,$18
    RETURN
   
    Resete:
 REPEAT
    DELAYMS 25                   ' Wait until conversion is complete     
    OREAD DQ,4,[Cnt]             ' Keep reading low pulses until
 UNTIL Cnt=0                     '  the DS1820 is finished
 Return
   

Desconectado manueltrigo

  • PIC10
  • *
  • Mensajes: 2
Re: Reloj y Termomero ( DS1307 Y DS1820)
« Respuesta #1 en: 25 de Febrero de 2014, 19:19:01 »
NOELILLOOOOO!!!!!!!
Qué alegría verte por estos lares, jejeje.
A ver si copio este programilla, ¡qué digo programilla, PROGRAMAZO!, en un PIC y le meto voltios a ver si rula. Hice unas pruebas hace unos meses con un reloj DS1307 en una protoboard y funcionaba, pero compré unos módulos baratísimos, anunciados para arduino, y no me hago con ellos. En teoría he seguido las pistas y las conexiones van bien, igual que mi montaje de protoboard. Entiendo que los hagan para arduino o para lo que sea es lo mismo. La comunicación es estándar. Molan porque van en smd, con integrados chiquitines y lleva ya su pila y todo. Y digo integrados, porque aprovecha y mete de paso una EEPROM.
Nos vemos.

Desconectado Noelillo

  • PIC12
  • **
  • Mensajes: 94
Re: Reloj y Termomero ( DS1307 Y DS1820)
« Respuesta #2 en: 02 de Marzo de 2014, 19:37:01 »
Manolito!!! No sabia que andarás x aquí!! Este programa tiene una parte tuya, lo de los números gordos para el termómetro.
Lo del reloj con componentes pequeñitos, creo que el problema es que esta conectado en una batería, creo!! Yo puse una batería de 3v y dejo de funcionar.

Un saludo.  :)