Autor Tema: temporizador programable  (Leído 2356 veces)

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

Desconectado lhyaz

  • PIC10
  • *
  • Mensajes: 11
temporizador programable
« en: 15 de Diciembre de 2008, 15:09:45 »
Hola a todos.

Estoy intentando hacer un temporizador programable con el 16f84a, pero en programacion ando perdido  :(
La idea que tengo es con 3 displays multiplexados y algunos pulsadores para modificar el tiempo y comenzar/detener la cuenta regresiva que seria como maximo a 9 horas y 59 minutos.

Ya cheque el buscador pero no encuentro nada parecido, de echo ya arme uno que encontre por la red concretamente aqui pero no me funcionó. (bueno, a medias pero en los displays muestra un desorden ;). y no se si es problema del pic o del programa en cuestion y por eso me gustaria intentar con otro programa para el pic, tal vez.

Agradesco cualquier ayuda que me puedan proporcionar....

Saludos y disculpen la molestia.

Desconectado lhyaz

  • PIC10
  • *
  • Mensajes: 11
Re: temporizador programable
« Respuesta #1 en: 16 de Diciembre de 2008, 20:49:37 »
Bueno, pues resulta que era el pic ya que compre uno nuevo y ya funciona en orden pero surgio un nuevo problema.... la cuenta no se detiene en 0, sigue de 0:00 a 0:  9, baja de uno en uno a 0:  0  y comienza otra cuenta en 0:t9.

aqui el programa. saludos y gracias!

            LIST      P=16F84, F=INHX8M
            include "P16FXX.inc"
            ORG     0x0000

            BCF     STATUS    , RP0
            BCF     STATUS    , RP1
            GOTO    Label_0001
            ORG     0x0004
            RETFIE
Label_0002  CLRF    0x24
            MOVLW   0x80
            BTFSC   PORTB     , 07
            ADDWF   0x24      , f
            MOVLW   0x40
            BTFSC   PORTB     , 06
            ADDWF   0x24      , f
            MOVLW   0x20
            BTFSC   PORTB     , 05
            ADDWF   0x24      , f
            MOVLW   0x10
            BTFSC   PORTB     , 04
            ADDWF   0x24      , f
            MOVF    0x27      , W
            ADDWF   0x24      , W
            MOVWF   PORTB
            NOP
            RETURN
Label_0008  MOVF    0x20      , W
            MOVWF   0x27
            CALL    Label_0002
            BCF     PORTA     , 02
            CALL    Label_0003
            BSF     PORTA     , 02
            MOVF    0x21      , W
            MOVWF   0x27
            CALL    Label_0002
            BCF     PORTA     , 03
            CALL    Label_0003
            BSF     PORTA     , 03
            MOVF    0x22      , W
            MOVWF   0x27
            CALL    Label_0002
            BCF     PORTA     , 04
            CALL    Label_0003
            BSF     PORTA     , 04
            RETURN
Label_0003  MOVLW   0x04
            MOVWF   0x2A
Label_0005  MOVLW   0x86
            MOVWF   0x29
Label_0004  DECFSZ  0x29      , f
            GOTO    Label_0004
            NOP
            DECFSZ  0x2A      , f
            GOTO    Label_0005
            NOP
            NOP
            NOP
            NOP
            NOP
            NOP
            RETURN
Label_0011  BTFSS   PORTA     , 01
            GOTO    Label_0006
            BTFSC   0x25      , 00
            GOTO    Label_0007
            MOVLW   0x00
            SUBWF   0x20      , f
            BTFSC   STATUS    , Z
            SUBWF   0x21      , f
            BTFSC   STATUS    , Z
            SUBWF   0x22      , f
            BTFSC   STATUS    , Z
            GOTO    Label_0007
            MOVLW   0x01
            MOVWF   0x2D
Label_0009  CALL    Label_0008
            BTFSC   PORTA     , 00
            GOTO    Label_0007
            DECFSZ  0x2D      , f
            GOTO    Label_0009
            MOVLW   0x00
            SUBWF   0x20      , f
            BTFSC   STATUS    , Z
            SUBWF   0x21      , f
            BTFSC   STATUS    , Z
            SUBWF   0x22      , f
            BTFSC   STATUS    , Z
            GOTO    Label_0001
            INCF    0x25      , f
            BSF     PORTB     , 04
            GOTO    Label_000A
Label_0012  BTFSS   PORTA     , 00
            GOTO    Label_0006
            BTFSS   0x25      , 00
            GOTO    Label_000B
            MOVLW   0x01
            MOVWF   0x2D
            MOVLW   0xC8
            MOVWF   0x23
Label_000C  CALL    Label_0008
            BTFSC   PORTA     , 01
            GOTO    Label_000B
            DECFSZ  0x23      , f
            GOTO    Label_000C
            DECFSZ  0x2D      , f
            GOTO    Label_000C
Label_0010  DECF    0x25      , f
            BCF     PORTB     , 04
            GOTO    Label_000D
Label_0006  MOVLW   0x02
            MOVWF   0x2B
            MOVLW   0xC8
            MOVWF   0x23
Label_000E  CALL    Label_0008
            BTFSS   PORTA     , 00
            BTFSC   PORTA     , 01
            GOTO    Label_000B
            DECFSZ  0x23      , f
            GOTO    Label_000E
            DECFSZ  0x2B      , f
            GOTO    Label_000E
            GOTO    Label_000F
Label_0001  CLRF    0x20
            CLRF    0x21
            CLRF    0x22
            CLRF    0x25
            CLRF    PORTA
            CLRF    PORTB
            BSF     STATUS    , RP0
            MOVLW   0x03
            MOVWF   TRISA
            MOVLW   0xE0
            MOVWF   TRISB
            BCF     STATUS    , RP0
            CLRF    INTCON
            BCF     PORTB     , 04
            BSF     PORTA     , 02
            BSF     PORTA     , 03
            BSF     PORTA     , 04
Label_000D  MOVLW   0x00
            MOVWF   EEADR
            BSF     STATUS    , RP0
            BSF     EECON1    , 00
            BCF     STATUS    , RP0
            NOP
            MOVF    EEDATA    , W
            MOVWF   0x20
            MOVLW   0x01
            MOVWF   EEADR
            BSF     STATUS    , RP0
            BSF     EECON1    , 00
            BCF     STATUS    , RP0
            NOP
            MOVF    EEDATA    , W
            MOVWF   0x21
            MOVLW   0x02
            MOVWF   EEADR
            BSF     STATUS    , RP0
            BSF     EECON1    , 00
            BCF     STATUS    , RP0
            NOP
            MOVF    EEDATA    , W
            MOVWF   0x22
            MOVLW   0x03
            MOVWF   0x26
            MOVLW   0x0A
            MOVWF   0x2C
Label_000A  MOVLW   0x3C
            MOVWF   0x28
Label_0015  MOVLW   0x00
            SUBWF   0x20      , f
            BTFSC   STATUS    , Z
            SUBWF   0x21      , f
            BTFSC   STATUS    , Z
            SUBWF   0x22      , f
            BTFSC   STATUS    , Z
            GOTO    Label_0010
            MOVLW   0xC8
            MOVWF   0x23
Label_0013  MOVF    0x20      , W
            MOVWF   0x27
            CALL    Label_0002
            BCF     PORTA     , 02
            CALL    Label_0003
            BSF     PORTA     , 02
            MOVF    0x21      , W
            MOVWF   0x27
            CALL    Label_0002
            BCF     PORTA     , 03
            CALL    Label_0003
            BSF     PORTA     , 03
            MOVF    0x22      , W
            MOVWF   0x27
            CALL    Label_0002
            BCF     PORTA     , 04
            CALL    Label_0003
            BSF     PORTA     , 04
            BTFSS   PORTA     , 00
            GOTO    Label_0011
Label_0007  BTFSS   PORTA     , 01
            GOTO    Label_0012
Label_000B  DECFSZ  0x23      , f
            GOTO    Label_0013
            MOVLW   0x99
            MOVWF   0x2B
Label_0014  DECFSZ  0x2B      , f
            GOTO    Label_0014
            NOP
            DECFSZ  0x28      , f
            GOTO    Label_0015
            BTFSS   0x25      , 00
            GOTO    Label_000A
            MOVLW   0x00
            SUBWF   0x22      , W
            BTFSC   STATUS    , Z
            GOTO    Label_0016
            DECF    0x22      , f
            GOTO    Label_000A
Label_0016  MOVLW   0x09
            MOVWF   0x22
            MOVLW   0x00
            SUBWF   0x21      , W
            BTFSC   STATUS    , Z
            GOTO    Label_0017
            DECF    0x21      , f
            GOTO    Label_000A
Label_0017  MOVLW   0x05
            MOVWF   0x21
            MOVLW   0x00
            SUBWF   0x20      , W
            BTFSC   STATUS    , Z
            GOTO    Label_0018
            DECF    0x20      , f
            GOTO    Label_000A
Label_0018  GOTO    Label_0001
Label_000F  BCF     PORTB     , 04
            MOVLW   0x03
            MOVWF   0x26
Label_001B  MOVLW   0x64
            MOVWF   0x2C
Label_0019  BSF     PORTA     , 02
            BSF     PORTA     , 03
            BSF     PORTA     , 04
            CALL    Label_0003
            CALL    Label_0003
            CALL    Label_0003
            DECFSZ  0x2C      , f
            GOTO    Label_0019
            MOVLW   0x64
            MOVWF   0x2C
Label_001A  CALL    Label_0008
            DECFSZ  0x2C      , f
            GOTO    Label_001A
            DECFSZ  0x26      , f
            GOTO    Label_001B
Label_0034  MOVLW   0x0A
            MOVWF   0x2C
Label_0024  MOVLW   0x64
            MOVWF   0x23
Label_001C  MOVF    0x20      , W
            MOVWF   0x27
            CALL    Label_0002
            BSF     PORTA     , 02
            CALL    Label_0003
            BSF     PORTA     , 02
            MOVF    0x21      , W
            MOVWF   0x27
            CALL    Label_0002
            BCF     PORTA     , 03
            CALL    Label_0003
            BSF     PORTA     , 03
            MOVF    0x22      , W
            MOVWF   0x27
            CALL    Label_0002
            BCF     PORTA     , 04
            CALL    Label_0003
            BSF     PORTA     , 04
            DECFSZ  0x23      , f
            GOTO    Label_001C
            MOVLW   0x09
            SUBWF   0x20      , W
            BTFSC   STATUS    , Z
            GOTO    Label_001D
            BTFSS   PORTA     , 01
            GOTO    Label_001D
            BTFSC   PORTA     , 00
            GOTO    Label_001D
            INCF    0x20      , f
            MOVLW   0x0A
            MOVWF   0x2C
Label_001D  MOVLW   0x00
            SUBWF   0x20      , W
            BTFSC   STATUS    , Z
            GOTO    Label_001E
            BTFSS   PORTA     , 00
            GOTO    Label_001E
            BTFSC   PORTA     , 01
            GOTO    Label_001E
            DECF    0x20      , f
            MOVLW   0x0A
            MOVWF   0x2C
Label_001E  BTFSS   PORTA     , 00
            BTFSC   PORTA     , 01
            GOTO    Label_001F
            GOTO    Label_0020
Label_001F  DECFSZ  0x2C      , f
            GOTO    Label_0021
            GOTO    Label_0022
Label_0021  MOVLW   0x64
            MOVWF   0x23
Label_0023  CALL    Label_0008
            DECFSZ  0x23      , f
            GOTO    Label_0023
            GOTO    Label_0024
Label_0020  MOVLW   0x0A
            MOVWF   0x2C
Label_002C  MOVLW   0x64
            MOVWF   0x23
Label_0025  MOVF    0x20      , W
            MOVWF   0x27
            CALL    Label_0002
            BCF     PORTA     , 02
            CALL    Label_0003
            BSF     PORTA     , 02
            MOVF    0x21      , W
            MOVWF   0x27
            CALL    Label_0002
            BSF     PORTA     , 03
            CALL    Label_0003
            BSF     PORTA     , 03
            MOVF    0x22      , W
            MOVWF   0x27
            CALL    Label_0002
            BCF     PORTA     , 04
            CALL    Label_0003
            BSF     PORTA     , 04
            DECFSZ  0x23      , f
            GOTO    Label_0025
            MOVLW   0x05
            SUBWF   0x21      , W
            BTFSC   STATUS    , Z
            GOTO    Label_0026
            BTFSS   PORTA     , 01
            GOTO    Label_0026
            BTFSC   PORTA     , 00
            GOTO    Label_0026
            INCF    0x21      , f
            MOVLW   0x0A
            MOVWF   0x2C
Label_0026  MOVLW   0x00
            SUBWF   0x21      , W
            BTFSC   STATUS    , Z
            GOTO    Label_0027
            BTFSS   PORTA     , 00
            GOTO    Label_0027
            BTFSC   PORTA     , 01
            GOTO    Label_0027
            DECF    0x21      , f
            MOVLW   0x0A
            MOVWF   0x2C
Label_0027  BTFSS   PORTA     , 00
            BTFSC   PORTA     , 01
            GOTO    Label_0028
            GOTO    Label_0029
Label_0028  DECFSZ  0x2C      , f
            GOTO    Label_002A
            GOTO    Label_0022
Label_002A  MOVLW   0x64
            MOVWF   0x23
Label_002B  CALL    Label_0008
            DECFSZ  0x23      , f
            GOTO    Label_002B
            GOTO    Label_002C
Label_0029  MOVLW   0x0A
            MOVWF   0x2C
Label_0033  MOVLW   0x64
            MOVWF   0x23
Label_002D  MOVF    0x20      , W
            MOVWF   0x27
            CALL    Label_0002
            BCF     PORTA     , 02
            CALL    Label_0003
            BSF     PORTA     , 02
            MOVF    0x21      , W
            MOVWF   0x27
            CALL    Label_0002
            BCF     PORTA     , 03
            CALL    Label_0003
            BSF     PORTA     , 03
            MOVF    0x22      , W
            MOVWF   0x27
            CALL    Label_0002
            BSF     PORTA     , 04
            CALL    Label_0003
            BSF     PORTA     , 04
            DECFSZ  0x23      , f
            GOTO    Label_002D
            MOVLW   0x09
            SUBWF   0x22      , W
            BTFSC   STATUS    , Z
            GOTO    Label_002E
            BTFSS   PORTA     , 01
            GOTO    Label_002E
            BTFSC   PORTA     , 00
            GOTO    Label_002E
            INCF    0x22      , f
            MOVLW   0x0A
            MOVWF   0x2C
Label_002E  MOVLW   0x00
            SUBWF   0x22      , W
            BTFSC   STATUS    , Z
            GOTO    Label_002F
            BTFSS   PORTA     , 00
            GOTO    Label_002F
            BTFSC   PORTA     , 01
            GOTO    Label_002F
            DECF    0x22      , f
            MOVLW   0x0A
            MOVWF   0x2C
Label_002F  BTFSS   PORTA     , 00
            BTFSC   PORTA     , 01
            GOTO    Label_0030
            GOTO    Label_0022
Label_0030  DECFSZ  0x2C      , f
            GOTO    Label_0031
            GOTO    Label_0022
Label_0031  MOVLW   0x64
            MOVWF   0x23
Label_0032  CALL    Label_0008
            DECFSZ  0x23      , f
            GOTO    Label_0032
            GOTO    Label_0033
Label_0022  MOVLW   0x00
            SUBWF   0x20      , f
            BTFSC   STATUS    , Z
            SUBWF   0x21      , f
            BTFSC   STATUS    , Z
            SUBWF   0x22      , f
            BTFSC   STATUS    , Z
            GOTO    Label_0034
            MOVLW   0x00
            MOVWF   EEADR
            MOVF    0x20      , W
            MOVWF   EEDATA
            CALL    Label_0008
            BSF     STATUS    , RP0
            BCF     EECON1    , 03
            BSF     EECON1    , 02
            MOVLW   0x55
            MOVWF   EECON2
            MOVLW   0xAA
            MOVWF   EECON2
            BSF     EECON1    , 01
Label_0035  NOP
            BCF     STATUS    , RP0
            CALL    Label_0008
            BSF     STATUS    , RP0
            BTFSS   EECON1    , 04
            GOTO    Label_0035
            NOP
            BTFSC   EECON1    , 03
            GOTO    Label_0022
            NOP
            BCF     EECON1    , 04
            BCF     EECON1    , 02
            BCF     STATUS    , RP0
Label_0037  NOP
            MOVLW   0x01
            MOVWF   EEADR
            MOVF    0x21      , W
            MOVWF   EEDATA
            CALL    Label_0008
            BSF     STATUS    , RP0
            BCF     EECON1    , 03
            BSF     EECON1    , 02
            MOVLW   0x55
            MOVWF   EECON2
            MOVLW   0xAA
            MOVWF   EECON2
            BSF     EECON1    , 01
Label_0036  NOP
            BCF     STATUS    , RP0
            CALL    Label_0008
            BSF     STATUS    , RP0
            BTFSS   EECON1    , 04
            GOTO    Label_0036
            NOP
            BTFSC   EECON1    , 03
            GOTO    Label_0037
            NOP
            BCF     EECON1    , 04
            BCF     EECON1    , 02
            BCF     STATUS    , RP0
Label_0039  NOP
            MOVLW   0x02
            MOVWF   EEADR
            MOVF    0x22      , W
            MOVWF   EEDATA
            CALL    Label_0008
            BSF     STATUS    , RP0
            BCF     EECON1    , 03
            BSF     EECON1    , 02
            MOVLW   0x55
            MOVWF   EECON2
            MOVLW   0xAA
            MOVWF   EECON2
            BSF     EECON1    , 01
Label_0038  NOP
            BCF     STATUS    , RP0
            CALL    Label_0008
            BSF     STATUS    , RP0
            BTFSS   EECON1    , 04
            GOTO    Label_0038
            NOP
            BTFSC   EECON1    , 03
            GOTO    Label_0039
            NOP
            BCF     EECON1    , 04
            BCF     EECON1    , 02
            BCF     STATUS    , RP0
            GOTO    Label_0001
 
            ORG     0x2000
            DATA    0x0F
            DATA    0x0F
            DATA    0x0F
            DATA    0x0F
 
            ORG     0x2007
            DATA    0x01
 
            ORG     0x2100
 

            END

Desconectado Javicho

  • Colaborador
  • PIC24F
  • *****
  • Mensajes: 570
Re: temporizador programable
« Respuesta #2 en: 17 de Diciembre de 2008, 03:33:21 »
Creo que ya son muchas lineas como para revisarlo, ni siquiera esta ordenado. Lo mejor es que  tu mismo lo hagas asi lo haces a tu manera. No es complicado de hacer pero si buscas bien en el foro encontrarás temas relacionados que sin duda te ayudaran mucho.

Javicho.

Desconectado lhyaz

  • PIC10
  • *
  • Mensajes: 11
Re: temporizador programable
« Respuesta #3 en: 17 de Diciembre de 2008, 14:15:09 »
Ok, trabajo en eso y les comento que fue.

Gracias por responder, Saludos!


 

anything