Sunteți pe pagina 1din 5

@ device xt_osc ; oscilador externo XT define osc 4 ; especifica que se va a utilizar uno de 4 Mhz ;creacion de variables tecla var

byte repit var byte ;donde se guarada tecla pulsada ;para hacer repeticiones

;configuracion de pines del pic 16f84a bip var porta.0 led var porta.1 door var porta.2 a var portb.0 b var portb.1 c var portb.2 d var portb.3 uno var portb.4 dos var portb.5 tres var portb.6 cuatro var portb.7 iniciando: high led:high bip pause 1000 low led:low bip goto teclauno barrido: low a ;sensar fila a if uno=0 then tecla=1:return if dos=0 then tecla=2:return if tres=0 then tecla=3:return if cuatro=0 then tecla=10:return high a low b ; comparar clave ;incica funcionamiento del sistema ;donde se conecta la chicharra ;donde se conecta el led ;donde se conecta rele para la puerta ;pines de las filas

if uno=0 then tecla=4:return if dos=0 then tecla=5:return if tres=0 then tecla=6:return if cuatro=0 then tecla=11:return high b low c if uno=0 then tecla=7:return if dos =0 then tecla=8:return if tres=0 then tecla=9:return if cuatro=0 then tecla=12:return high c low d if uno=0 then tecla=14:return if dos=0 then tecla=0:return if tres=0 then tecla=15:return if cuatro=0 then tecla=13:return high d pause 10 goto barrido ;rutina antirrebote de teclas ptecla: high led:low bip pause 100 low led :low bip espacio: if uno=0 then espacio if dos=0 then espacio if tres=0 then espacio if cuatro=0 then espacio pause 25 return ;rutina para comparar claves teclauno: gosub barrido gosub ptecla if tecla=1then teclados

goto falso teclados: gosub barrido:gosub ptecla if tecla=2 then teclatres goto falso1 teclatres: gosub barrido:gosub ptecla if tecla=3 then teclacuatro goto falso2 teclacuatro gosub barrido:gosub ptecla if tecla=4 then open goto falso3 open: for repit=1 to 2 pause 100 high led:high bip pause 100 low led:low bip next high door pause 3000 low door goto teclauno ;rutina teclas erroneas falso: gosub barrido:gosub ptecla falso1: gosub barrido:gosub ptecla falso2: gosub barrido:gosub ptecla

falso3: for repit=1 to 3 pause 100 high led:high bip pause 100 low led: low bip next goto teclauno

end

Hola que tal, disee este programa, pero tengo un gran problema No se como conectar un teclado matricial en proteus. alguna sugerencia?? aqui esta el prog
define lcd_lines 4 DEFINE LCD_DREG PORTB DEFINE LCD_DBIT 4 DEFINE LCD_RSREG PORTB DEFINE LCD_RSBIT 3 DEFINE LCD_EREG PORTB DEFINE LCD_EBIT 2 LCDOUT $FE,1 A VAR PORTD.0 B VAR PORTD.1 C VAR PORTD.2 D VAR PORTD.3 UNO VAR PORTD.5 DOS VAR PORTD.6 TRES VAR PORTD.7 SALIDA VAR WORD TECLEANDO: GOSUB BARRIDO GOSUB ANTIRREBOTE LCDOUT SALIDA GOTO TECLEANDO BARRIDO:

LOW A IF UNO=0 THEN SALIDA="1":RETURN IF DOS=0 THEN SALIDA="2":RETURN IF TRES=0 THEN SALIDA="3":RETURN HIGH A LOW B IF UNO=0 THEN SALIDA="4":RETURN IF DOS=0 THEN SALIDA="5":RETURN IF TRES=0 THEN SALIDA="6":RETURN HIGH B LOW C IF UNO=0 THEN SALIDA="7":RETURN IF DOS=0 THEN SALIDA="8":RETURN IF TRES=0 THEN SALIDA="9":RETURN HIGH C LOW D IF UNO=0 THEN SALIDA="*":RETURN IF DOS=0 THEN SALIDA="0":RETURN IF TRES=0 THEN SALIDA="#":RETURN HIGH D PAUSE 10 GOTO BARRIDO ANTIRREBOTE: IF UNO=0 THEN ANTIRREBOTE IF DOS=0 THEN ANTIRREBOTE IF TRES=0 THEN ANTIRREBOTE PAUSE 25 RETURN END

S-ar putea să vă placă și