Prog Test2
Prog Test2
; *** Configuration
LIST p=16F84A ; Processeur 16F84A
#INCLUDE <p16F84A.inc> ; Définition des registres internes du 16F84
__CONFIG _CP_OFF & _WDT_OFF & _HS_OSC ; Option de programmation
; *** Définitions
org 0x00
goto Start
; * Programme principal
Start
BSF STATUS,5
BSF TRISA,0
BSF TRISA,1
BCF TRISB,0
BCF TRISB,1
BCF STATUS,5
CALL T00
B0 BTFSS PORTA,0
GOTO B1
BTFSS PORTA,1
GOTO B2
CALL T11
GOTO B0
B1 BTFSS PORTA,1
GOTO B3
CALL T10
GOTO B0
B2 CALL T01
GOTO B0
B3 CALL T00
GOTO B0
T00
MOVLW 0X00
MOVWF PORTB
RETURN
T01
MOVLW 0X01
MOVWF PORTB
CALL delais
MOVLW 0X00
MOVWF PORTB
CALL delais
RETURN
T10
MOVLW 0X02
MOVWF PORTB
CALL delais
MOVLW 0X00
MOVWF PORTB
CALL delais
RETURN
T11
MOVLW 0X03
MOVWF PORTB
CALL delais
MOVLW 0X00
MOVWF PORTB
CALL delais
RETURN
RETURN
CALL delais
BCF PORTB,0
CALL delais
GOTO B1
; * Sous-routine Tempo10s
delais:
MOVLW 0XFF
MOVWF 0x0D
L3 DECFSZ 0X0D,1
GOTO L1
return
L1 MOVLW 0XFF
MOVWF 0x0C
L2 DECFSZ 0X0C,1
GOTO L2
GOTO L3
return
END Start