Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; *********************************
- ; Pizzolato Luca
- ; 2Bini Microcontroleur 2
- ; *********************************
- ;Dividende
- ;Diviseur
- Status EQU 03
- PORTB EQU 06
- PORTA EQU 05
- Tmr0 EQU 01
- cpt02 EQU 0c
- cpt01 EQU 0d
- Chiffre EQU 0E
- Quotient EQU 0f
- Dividende EQU 1A
- Reste EQU 1B
- Apparition EQU 1C
- ChiffrePre EQU 1D
- MOVLW B'11001000'
- Option
- MOVLW 0 ; config du portB
- TRIS PORTB ;
- CLRF PORTB
- MOVWF ChiffrePre
- MOVLW B'00011' ; config du portA
- TRIS PORTA ;
- CLRF PORTA
- ; eteindre l'afficheur mettre une valeur supperieur a 9
- MOVLW b'00001111'
- movwf PORTB
- ; test sur les boutons
- Debut
- TESTAPP BTFSC PORTA,0
- GOTO TESTAPP
- Call Tempo
- TESTREL BTFSS PORTA,0
- GOTO TESTREL
- ; recupérer la valeur du timer et faire la division
- MOVF Tmr0,0
- CALL Div
- MOVLw d'5'
- ADDWf Reste,0
- movwf Apparition
- Lancer Call Tempo
- ; eteindre l'afficheur mettre une valeur supperieur a 9
- MOVLW b'00001111'
- movwf PORTB
- Call Tempo
- Call Tempo
- Gen Movf Tmr0,0
- CALL Div
- MOVF Reste,0
- INCF Reste,1
- ; MOVF Reste,0
- ; SUBWF ChiffrePre,0
- ; BTFSC Status, 2
- ; Goto Gen
- MOVF Reste,0
- MOVWF PORTB
- MOVF Reste,0
- MOVWF ChiffrePre
- DECFSZ Apparition,1
- Goto Lancer
- Goto Debut
- MOVF Tmr0,0
- MOVWF Chiffre
- movf Chiffre,0
- Call Debut
- Movwf Chiffre
- movf Chiffre,0
- movwf PORTB
- ; Sous routine pour prendre le Mod6 du timer
- Div MOVWF Dividende
- CLRF Quotient
- Moins MOVLW d'6' ; mettre 6 dans W
- SUBWF Dividende,0 ; Pour ne pas modifier dividende 184-6 En gros pour faire le test Divid> diviseur
- ; tester pour voir si la soustraction est ok ==> bit de carry
- ; si tout va bien le bit carry est a 1
- BTFSS Status,0
- GOTO Suite
- MOVWF Dividende
- INCF Quotient
- GOTO Moins
- Suite MOVF Dividende,0
- MOVWF Reste
- MOVF Reste,0
- Return
- ; Sous routine de la tempo pour l'anti rebond du bouton
- Tempo MOVLW d'255'
- MOVWF cpt02
- LOOP2 MOVLW d'255'
- MOVWF cpt01
- LOOP1 DECFSZ cpt01
- GOTO LOOP1
- DECFSZ cpt02
- GOTO LOOP2
- Return
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement