7-Segment Display e Dakika ve Saniye Yazdırma

7-Segment Display e Dakika ve Saniye Yazdırma
      P16F877A mikroişlemci ile assembly dilinde yazılmış 7 segment displaye timer kullanılarak dakika ve saniye yazdırma



								LIST P=16F877A
	#INCLUDE "P16F877A.INC"
	DEGER EQU 0X20
	SAYI EQU 0X21
	SN EQU 0X22
	SAYI2 EQU 0X23
	SN2 EQU 0X24
	SAYI3 EQU 0X25
	DK EQU 0X26
	SAYI4 EQU 0X27
	DK2 EQU 0X28
	TMRSAYAC EQU 0X29
	ORG 0X00
	CALL INIT
	GOTO MAIN
	ORG 0X04
	CALL KESME
MAIN

	BCF PORTC,0
	MOVF SN,W
	MOVWF PORTB
	CALL GECIKME
	BSF PORTC,0
	
	BCF PORTC,1
	MOVF SN2,W
	MOVWF PORTB
	CALL GECIKME
	BSF PORTC,1

	BCF PORTC,2
	MOVF DK,W
	MOVWF PORTB
	BSF PORTB,7
	CALL GECIKME
	BSF PORTC,2

	BCF PORTC,3
	MOVF DK2,W
	MOVWF PORTB
	CALL GECIKME
	BSF PORTC,3

GOTO MAIN

INIT
	BANKSEL TRISB
	CLRF TRISB
	CLRF TRISC
	CLRF TRISD

	BANKSEL PORTB
	CLRF PORTB
	MOVLW 0XFF
	MOVWF PORTC
	
	BANKSEL T1CON
	BSF T1CON,TMR1ON
	BCF T1CON,TMR1CS
	BSF T1CON,T1CKPS0
	BSF T1CON,T1CKPS1

	BANKSEL PIR1
	BCF PIR1,TMR1IF
	BANKSEL PIE1
	BSF PIE1,0

	BANKSEL INTCON
	BSF INTCON,GIE
	BSF INTCON,PEIE
	CLRF SAYI
	CLRF SAYI2
	CLRF SAYI3
	CLRF SAYI4
	
	BANKSEL TMR1L
	MOVLW 0X58
	MOVWF TMR1L
	MOVLW 0X9E
	MOVWF TMR1H
	
	MOVLW B'00111111'
	MOVWF SN
	MOVLW B'00111111'
	MOVWF SN2
	MOVLW B'00111111'
	MOVWF DK
	MOVLW B'00111111'
	MOVWF DK2
	BCF STATUS,Z
	BSF PORTD,0

	MOVLW 0X0A
	MOVWF TMRSAYAC
	RETURN
SAYILAR
	ADDWF PCL,F
	RETLW B'00111111'
	RETLW B'00000110'
	RETLW B'01011011'
	RETLW B'01001111'
	RETLW B'01100110'
	RETLW B'01101101'
	RETLW B'01111101'
	RETLW B'00000111'
	RETLW B'01111111'
	RETLW B'01101111'
	NOP
	RETURN

KESME
	BCF INTCON,GIE
	BCF PIR1,0

	MOVLW 0X58
	MOVWF TMR1L
	MOVLW 0X9E
	MOVWF TMR1H

	DECFSZ TMRSAYAC,F
	GOTO ISLEM
	CALL DEGISTIR

DEGISTIR
	MOVLW 0XFF
	XORWF PORTD,F

	MOVLW 0X0A
	MOVWF TMRSAYAC

	INCF SAYI,F
	MOVLW 0X0A
	SUBWF SAYI,W
	BTFSS STATUS,Z
	GOTO SN_ARTIR
	GOTO SN2_ARTIR
SN_ARTIR
	MOVF SAYI,W
	CALL SAYILAR	
	MOVWF SN
	GOTO ISLEM
SN2_ARTIR
	CLRF SAYI
	MOVLW B'00111111'
	MOVWF SN
	BCF STATUS,Z
	INCF SAYI2,F
	MOVLW 0X06
	SUBWF SAYI2,W
	BTFSS STATUS,Z
    GOTO DEVAM_ET
	GOTO DK_ARTIR
DEVAM_ET
	MOVF SAYI2,W
	CALL SAYILAR
	MOVWF SN2
	GOTO ISLEM
DK_ARTIR
	CLRF SAYI2
	MOVLW B'00111111'
	MOVWF SN2
	BCF STATUS,Z
	INCF SAYI3,F
	MOVLW 0X0A
	SUBWF SAYI3,W
	BTFSS STATUS,Z
	GOTO DEVAM_DK
	GOTO DK2_ARTIR
DEVAM_DK
	MOVF SAYI3,W
	CALL SAYILAR
	MOVWF DK
	GOTO ISLEM
DK2_ARTIR
	CLRF SAYI3
	MOVLW B'00111111'
	MOVWF DK
	BCF STATUS,Z
	INCF SAYI4,F
	MOVLW 0X06
	SUBWF SAYI4,W
	BTFSS STATUS,Z
	GOTO DEVAM_DK2
	GOTO INIT
DEVAM_DK2
	MOVF SAYI4,W
	CALL SAYILAR
	MOVWF DK2
ISLEM
	BSF INTCON,GIE
	GOTO MAIN
RETURN

GECIKME
	MOVLW 0X40
	MOVWF DEGER
DONGU
	DECFSZ DEGER,F
	GOTO DONGU
	RETURN
END
						



Proje kodlarını ve Proteus ISIS Tasarımını İndirmek İçin Aşağıdaki Bağlantıya Tıklayınız
download





Gönderen : Admin
1168
24-09-2017