Created
January 7, 2021 08:07
-
-
Save ertugrulozcan/ae8e574b0ddb50b9a2818ad1095ee739 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;===SARI_KAFA.ASM==== | |
LIST P=16F628A | |
INCLUDE "P16F628A.INC" | |
__CONFIG _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_ON & _BODEN_OFF & _LVP_OFF & _DATA_CP_OFF & _CP_OFF | |
;----------------------------------------------------------- | |
CBLOCK 20h | |
AL,AH,BL,BH | |
ENDC | |
ORG h'00' ;Entrypoint | |
CLRF PORTB ;Reset PortB | |
BANKSEL TRISB ;Switch to BANK1 | |
CLRF TRISB ;Out allpins of PortB | |
MOVLW H'FF' ;W ? h'FF' | |
MOVWF TRISA ;In allpins of PortA | |
BANKSEL PORTB ;Switch BANK0 | |
MOVLW h'07' ; | |
MOVWF CMCON ; | |
BASLA | |
MOVLW h'A3' ;W ? h'04' | |
MOVWF AL ;AL ? h'04' | |
MOVLW h'61' ;W ? h'00' | |
MOVWF AH ;AH ? h'00' | |
MOVLW h'E0' ;W ? h'01' | |
MOVWF BL ;BL ? h'01' | |
MOVLW h'2E' ;W ? h'00' | |
MOVWF BH ;BH ? h'00' | |
CIKAR | |
MOVF BL, W ;W ? BL | |
SUBWF AL, F ;AL=AL-W(BL), alt bayt sonucu | |
BTFSS STATUS, 0 ;CARRY FLAG==0 ? | |
DECF AH, F ;True, AH=AH-1 | |
MOVF BH, W ;False, W ? BH | |
SUBWF AH, F ;AH=AH-W(BH), üst bayt sonucu | |
ALT_BAYT_GOSTER | |
MOVF AL, W ;W ? AL | |
MOVWF PORTB ;Alt bayt sonucunu göster | |
TEST_RA0 | |
BTFSC PORTA, 0 ;RA0 butonuna basıldı mı? | |
GOTO TEST_RA0 ;Hayır, tekrar test et | |
MOVF AH, W ;Evet, W ? AH | |
MOVWF PORTB ;Üst bayt sonucunu göster. | |
DONGU | |
GOTO DONGU | |
END | |
;----------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment