0% found this document useful (0 votes)
12 views2 pages

Prog Test2

This document describes code for blinking an LED on port RA0 of a PIC microcontroller. It defines the microcontroller as a PIC16F84A and configures the oscillator and watchdog timer. The main program loop blinks the LED using different patterns by checking the states of two input ports and calling subroutines to turn the LED on and off on port RB0 with a delay.

Uploaded by

RAZIQ YOUSSEF
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Prog Test2

This document describes code for blinking an LED on port RA0 of a PIC microcontroller. It defines the microcontroller as a PIC16F84A and configures the oscillator and watchdog timer. The main program loop blinks the LED using different patterns by checking the states of two input ports and calling subroutines to turn the LED on and off on port RB0 with a delay.

Uploaded by

RAZIQ YOUSSEF
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

; Clignotement d'une Led sur RA0

; *** 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

You might also like