• Viernes 29 de Marzo de 2024, 06:46

Autor Tema:  espero QUE A ALGUIEN LE SIRVA ESTO :)  (Leído 2208 veces)

elias1

  • Nuevo Miembro
  • *
  • Mensajes: 2
    • Ver Perfil
espero QUE A ALGUIEN LE SIRVA ESTO :)
« en: Domingo 7 de Abril de 2013, 19:57 »
0
;ESTE CODIGOESTA EN ASM. Y ES EL TECLADO MATRICIAL
;ESPERO A ALGUIEN LE AYUDE
 
 List p=16f84a
      INCLUDE "P16F84A.INC"
          __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON  & _XT_OSC ;
     
     

 org 0x00 ; Inicio de programa
BEGIN
      bsf STATUS,5; Inicio configuracion E/S
    clrf PORTA ; PORTA como salida
    movlw 0xF0
    movwf PORTB ;Puerto B como entradas
    bcf STATUS,5; Fin configuracion E/S

TECLADO

         
         bsf         PORTB,0         ;pongo en 1 la primera fila
   
         btfsc      PORTB,4            ;rutina tecla "1"
         goto      tecla1
         btfsc      PORTB,5            ;rutina tecla "2"
         goto      tecla2
         btfsc      PORTB,6            ;rutina tecla "3"
         goto      tecla3
   

         bcf         PORTB,0         ;pongo en 0 la primera fila
         bsf         PORTB,1         ;pongo en 1 la segunda fila
      
         btfsc      PORTB,4            ;rutina tecla "4"
         goto      tecla4
         btfsc      PORTB,5            ;rutina tecla "5"
         goto      tecla5
         btfsc      PORTB,6            ;rutina tecla "6"
         goto      tecla6
      
         bcf         PORTB,1         ;pongo en 0 la segunda fila
         bsf         PORTB,2         ;pongo en 1 la tercer fila
   
         btfsc      PORTB,4            ;rutina tecla "7"
         goto      tecla7
         btfsc      PORTB,5            ;rutina tecla "8"
         goto      tecla8
         btfsc      PORTB,6            ;rutina tecla "9"
         goto      tecla9
   
         bcf         PORTB,2         ;pongo en 0 la tercer fila
         bsf         PORTB,3         ;pongo en 1 la cuarta fila
   
         btfsc      PORTB,5            ;rutina tecla "0"
         goto      tecla0
         btfsc      PORTB,6            ;rutina tecla "numeral"
         goto      teclanum

         bcf         PORTB,3         ;pongo en 0 la cuarta fila
         goto      TECLADO
tecla1   
                           
         btfsc      PORTB,4            ;chequeo si ya soltaron la tecla   
         goto      tecla1                         
         MOVLW      0X01
         movwf      PORTA
         goto      TECLADO
      
tecla2         
         btfsc      PORTB,5
         goto      tecla2            
         movlw      0x02
         movwf      PORTA
         goto      TECLADO
      
tecla3         
         btfsc      PORTB,6
         goto      tecla3         
         movlw   0x03
         movwf      PORTA
         goto      TECLADO
      
tecla4
         btfsc      PORTB,4
         goto      tecla4
         movlw   0x04
         movwf      PORTA
         goto      TECLADO
      
               
tecla5         
         btfsc      PORTB,5
         goto      tecla5            
         movlw   0x05
         movwf      PORTA
         goto      TECLADO
tecla6
         btfsc      PORTB,6
         goto      tecla6
         movlw   0X6
         movwf      PORTA
         goto      TECLADO
      
tecla7         
         btfsc      PORTB,4
         goto      tecla7
         movlw   0x07
         movwf      PORTA
         goto      TECLADO      
tecla8         
         btfsc      PORTB,5
         goto      tecla8
         movlw   0x08
         movwf      PORTA
         goto      TECLADO      
tecla9         
         btfsc      PORTB,6
         goto      tecla9
         movlw   0x09
         movwf      PORTA
         goto      TECLADO
tecla0         
         btfsc      PORTB,5       ;chequeo si ya soltaron la tecla
         goto      tecla0
         movlw   0x00
         movwf      PORTA
         goto      TECLADO
teclanum      
         btfsc      PORTB,6
         goto      teclanum
         movlw      0xB
         movwf      PORTA
         goto      TECLADO

end  ; Fin de programa
El mensaje contiene 1 archivo adjunto. Debes ingresar o registrarte para poder verlo y descargarlo.
« última modificación: Domingo 7 de Abril de 2013, 20:00 por elias1 »