You are on page 1of 1

LIST p= 16F84A

#INCLUDE <p16F84A.inc>
__CONFIG _CP_OFF & _WDT_OFF & _HS_OSC

RA0 EQU h'01'


RA1 EQU h'02'
RB0 EQU h'03'
RB1 EQU h'04'
RA2 EQU h'05'
CBLOCK 0x0C
duty , low_t , count
ENDC

ORG H'0000'
GOTO start

tempo MOVWF count


NOP
loop1 DECFSZ count,1
GOTO loop1
RETURN

start BSF STATUS,RP0


CLRF TRISB
MOVLW D'255'
MOVWF TRISA
BCF STATUS,RP0
m CLRF PORTB
MOVLW 0x80
MOVWF duty
MOVLW 0x80
MOVWF low_t
L BSF PORTB,0
Y BTFSC PORTA,0
GOTO LAB
K BTFSC PORTA,1
GOTO LAB1
MOVF duty,0
CALL tempo
BCF PORTB,0
MOVF low_t,0
CALL tempo
GOTO L

LAB DECFSZ duty,1


GOTO K
GOTO m

LAB1 INCFSZ duty,1


GOTO Y
GOTO m

END

You might also like