Cevap: PIC16F877 İle Gün Saat Derece Ve Takvim Görtergeli Devre Yapımı pcb
ŞÖYLE ASSEMLY KODU VERSEM??
LIST P = 16F877 n = 66 mm = ON
ERRORLEVEL -302
INCLUDE <p16F877.inc>
#define TESTING 1
__CONFIG _CP_ALL & _DEBUG_OFF & _BODEN_OFF & _WRT_ENABLE_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC & _LVP_OFF
org 0x0000 ; RESET vector location
goto STARTER
org 0x0004 ; Interrupt vector location
goto Interrupt_v
org 0x0005
STARTER
call Init
START
clrf SEC
CALL RefreshDisplay
call ScanKeys
goto START
INCLUDE <VAR.H>
INCLUDE <INIT.H>
ScanKeys
BTFSS PORTB0x00
GOTO SCANKEYSINIT
GOTO SCANKEYSEND
SCANKEYSINIT
BSF Flag_RegAyar
BTFSS PORTB0x01
GOTO TUSHOURP
BTFSS PORTB0x02
GOTO TUSMINP
goto SCANKEYSEND
TUSHOURP
BTFSS PORTB0x01
GOTO $-1
; INCF HOURF
call INC_HOUR
CLRF SEC
GOTO SCANKEYSEND
TUSMINP
BTFSS PORTB0x02
GOTO $-1
; INCF MINF
call INC_MIN
CLRF SEC
SCANKEYSEND
BCF Flag_RegAyar
RETURN
RefreshDisplay
btfsS PORTB0x00
goto ShowSaat
BTFSS Flag_RegSaat
GOTO ShowTermometre
ShowSaat ;saat dakika gosterir
CLRF PORTB
movf HOURW
CALL BINTOBCD
MOVF MSDW
CALL CEV7SEGMENT
MOVWF PORTD
BSF PORTB0x07
CALL WAIT
BCF PORTB0x07
MOVF LSDW
CALL CEV7SEGMENT
MOVWF PORTD
BSF PORTB0x06
CALL WAIT
BCF PORTB0x06
movf MINW
CALL BINTOBCD
MOVF MSDW
CALL CEV7SEGMENT
MOVWF PORTD
BSF PORTB0x05
CALL WAIT
BCF PORTB0x05
MOVF LSDW
CALL CEV7SEGMENT
MOVWF PORTD
BSF PORTB0x04
CALL WAIT
BCF PORTB0x04
GOTO RefSon
ShowTermometre
clrf PORTE
movf D100W
ANDLW 0x0F
CALL CEV7SEGMENT
MOVWF PORTD
BSF PORTB0x07
CALL WAIT
BCF PORTB0x07
MOVF D10W
ANDLW 0x0F
CALL CEV7SEGMENT
MOVWF PORTD
BSF PORTB0x06
CALL WAIT
BCF PORTB0x06
movlw 0x0A
CALL CEV7SEGMENT
MOVWF PORTD
BSF PORTB0x05
CALL WAIT
BCF PORTB0x05
movlw 0x0B
CALL CEV7SEGMENT
MOVWF PORTD
BSF PORTB0x04
CALL WAIT
BCF PORTB0x04
RefSon
return
CEV7SEGMENT
addwf PCLF
retlw B'11000000' ;0
retlw B'11111001' ;1
retlw B'10100100' ;2
retlw B'10110000' ;3
retlw B'10011001' ;4
retlw B'10010010' ;5
retlw B'10000010' ;6
retlw B'11111000' ;7
retlw B'10000000' ;8
retlw B'10010000' ;9
retlw B'10011100' ;derece
retlw B'11000110' ;C
WAIT
movlw 0x10
movwf SAYAC1
WAIT1
movlw 0x40
movwf SAYAC2
decfsz SAYAC2F
goto $-1
decfsz SAYAC1F
goto WAIT1
return
INC_TIME
; bcf FLAG_REGINT_OCCURED
INC_SEC
incf SECF
movlw .60
subwf SECW
btfsc STATUSZ
goto INCSECone
GOTO INCTIMEEND
INCSECone
clrf SEC
BTFSC Flag_RegAyar
GOTO INCTIMEEND
INC_MIN
incf MINF
movlw .60
subwf MINW
btfsc STATUSZ
goto INCMINOne
GOTO INCTIMEEND
INCMINOne
clrf MIN
BTFSC Flag_RegAyar
GOTO INCTIMEEND
INC_HOUR
incf HOURF
movlw .24
subwf HOURW
btfsc STATUSZ
goto INCHOUROne
GOTO INCTIMEEND
INCHOUROne
clrf HOUR
INCTIMEEND
RETURN
Interrupt_v
BCF STATUS RP0 ; Bank 0
movwf W_Save
movf STATUSW
movwf S_Save
BTFSC PIR1 TMR1IF ; Timer 1 overflowed?
GOTO T1_OVRFL ; YES Service the Timer1 Overflow Interrupt
ERROR1
BSF PORTE1
BCF PORTE1
GOTO ERROR1
; movlw 0x02
; xorwf PORTEF
; GOTO ENDINT ; NO Error Condition - Unknown Interrupt
T1_OVRFL
BCF PIR1TMR1IF
MOVLW 0x80 ;
MOVWF TMR1H ; 1 Second Overflow
; clrf TMR1L
MOVLW 0x01
XORWF PORTEF
btfss Flag_RegAyar
CALL INC_TIME
ENDINT
BCF STATUS RP0 ; Bank 0
bsf Flag_RegSaat
bcf Flag_RegTermometre
btfsc Flag_RegAyar
goto sonint
incf TimeoutF
movlw 0x0A
subwf TimeoutW
btfss STATUSZ
goto sonint
CALL READSENS
CALL TOBCD
clrf Timeout
bcf Flag_RegSaat
bsf Flag_RegTermometre
sonint
movf S_SaveW
movwf STATUS
movf W_SaveW
RETFIE ; Return / Enable Global Interrupts
BINTOBCD CLRF MSD ; This value contain the 10's digit value
MOVWF LSD ; This value contain the 1's digit value
TENS_SUB MOVLW .10 ; A decimal 10
SUBWF LSD W ;
BTFSS STATUS C ; Did this subtract cause a Negative Result?
GOTO BINTOBCDSON
MOVWF LSD ; No move the result into LSD
INCF MSD F ; Increment the most significat digit
GOTO TENS_SUB ;
BINTOBCDSON MOVF LSDW
RETURN
INCLUDE <READSENS.H>
org 0x0200
INCLUDE <TOBCD.H>
org 0x0100
;
NUM_TABLE MOVWF TEMP ; Store value to TEMP register
MOVLW HIGH NUM_TABLE ; Ensure that the PCLATH high has the
MOVWF PCLATH ; correct value
MOVF TEMP W ; Value into table
ANDLW 0x0F ; Mask to 4-bits (00 - 0Fh)
NUM_TBL ADDWF PCL F ; Determine Offset into table
RETLW '0' ; ASCII value of "0" in W register
RETLW '1' ; ASCII value of "1" in W register
RETLW '2' ; ASCII value of "2" in W register
RETLW '3' ; ASCII value of "3" in W register
RETLW '4' ; ASCII value of "4" in W register
RETLW '5' ; ASCII value of "5" in W register
RETLW '6' ; ASCII value of "6" in W register
RETLW '7' ; ASCII value of "7" in W register
RETLW '8' ; ASCII value of "8" in W register
RETLW '9' ; ASCII value of "9" in W register
; Any enter after is in error (Display an E)
RETLW 'E' ; ASCII value of "E" in W register
RETLW 'E' ; ASCII value of "E" in W register
RETLW 'E' ; ASCII value of "E" in W register
RETLW 'E' ; ASCII value of "E" in W register
RETLW 'E' ; ASCII value of "E" in W register
NUM_TBL_END RETLW 'E' ; ASCII value of "E" in W register
end
|