; 16F877 PORT TANIMA DENEYLERİ PROGRAMI
;PORTB SADECE TRISB ÖN AYARLAMASIYLA GİRİŞ YA DA ÇIKIŞ OLARAK
;KULLANILABİLİR.
LIST P=16F877
INCLUDE "P16F877.INC"
__CONFIG H'3F71' ;XTAL OSC
CNTH EQU 0X21
CNTL EQU 0X22
#DEFINE BUTON PORTB,7 ;
#DEFINE CIKIS PORTB,2 ;
;----------------portlar hazırlanır-----------------
INITIAL
BSF STATUS,RP0 ;bank1
BSF TRISB,7 ;BUTON
BCF TRISB,0 ;CIKIS
BCF TRISB,1
BCF TRISB,2
BCF TRISB,3
CLRF INTCON ;TÜM KESMELER İPTAL
BCF STATUS,RP0
;------------------------------------------------
BASLA
;BTFSS
BTFSS BUTON
GOTO BASLA
INCF PORTB,F
CALL TIMER
GOTO BASLA
;------------------------
TIMER
MOVLW 0XFF
MOVWF CNTH
NEXT2 MOVLW 0XFF
MOVWF CNTL
NEXT1 DECFSZ CNTL,F
GOTO NEXT1
DECFSZ CNTH,F
GOTO NEXT2
RETURN
;------------------------
END
|