LIST p=16F84A
#include <p16f84a.inc>
INDICATOR4 equ 0x1C
INDICATOR3 equ 0x1D
INDICATOR2 equ 0x1E
INDICATOR1 equ 0x1F
COUNT equ 0x2C
Reg_1 equ 0x0C
Reg_2 equ 0x0D
Reg_3 equ 0x0E
DlyaIND4 equ 0x3C
DlyaIND3 equ 0x3D
DlyaIND2 equ 0x3E
DlyaIND4_1 equ 0x3C
DlyaIND3_1 equ 0x3D
DlyaIND2_1 equ 0x3E
DlyaIND4_2 equ 0x3F
DlyaIND3_2 equ 0x4C
DlyaIND2_2 equ 0x4D
DlyaIND4_3 equ 0x4E
DlyaIND3_3 equ 0x4F
DlyaIND2_3 equ 0x5C
COUNTERS equ 0x5E
org 0x00
bsf STATUS,RP0
movlw b'10000000'
movwf TRISB
movlw b'11000'
movwf TRISA
bcf STATUS,RP0
Proverka1 movlw .0
movwf INDICATOR4
movwf INDICATOR3
movwf INDICATOR2
movwf INDICATOR1
movlw .1
movwf COUNT
;0000
movlw b'11111111'
movwf PORTB
btfss PORTB,7
goto two
btfss PORTA,3
call abcf
goto START
two
btfsc PORTA,4
goto out
goto P1
P1 btfss PORTB,7
goto P1
goto START
ZAPOMINANIE movf INDICATOR4,w ;ЗАПОМИНАНИЕ
movwf DlyaIND4
movf INDICATOR3,w
movwf DlyaIND3
movf INDICATOR2,w
movwf DlyaIND2
incf COUNTERS,f
RETURN
ZAPOMINANIE1 movf INDICATOR4,w ;ЗАПОМИНАНИЕ
movwf DlyaIND4_1
movf INDICATOR3,w
movwf DlyaIND3_1
movf INDICATOR2,w
movwf DlyaIND2_1
incf COUNTERS,f
RETURN
ZAPOMINANIE2 movf INDICATOR4,w ;ЗАПОМИНАНИЕ
movwf DlyaIND4_2
movf INDICATOR3,w
movwf DlyaIND3_2
movf INDICATOR2,w
movwf DlyaIND2_2
incf COUNTERS,f
RETURN
ZAPOMINANIE3 movf INDICATOR4,w ;ЗАПОМИНАНИЕ
movwf DlyaIND4_3
movf INDICATOR3,w
movwf DlyaIND3_3
movf INDICATOR2,w
movwf DlyaIND2_3
incf COUNTERS,f
RETURN
abcf addwf PCL,f
goto ZAPOMINANIE
goto ZAPOMINANIE1
goto ZAPOMINANIE2
goto ZAPOMINANIE3
decf COUNTERS,f
return
goto VIVOD1
nop
goto VIVOD2
nop
goto VIVOD3
nop
goto VIVOD4
nop
decf COUNTERS,f
decf COUNTERS,f
return
out incf COUNTERS,F
incf COUNTERS,F
call abcf
VIVOD1 movlw DlyaIND4
movwf PORTB
bsf PORTA,0
movlw DlyaIND3
movwf PORTB
bsf PORTA,1
movlw DlyaIND2
movwf PORTB
bsf PORTA,2
BTFSS PORTB,7
return
VIVOD2 movlw DlyaIND4_1
movwf PORTB
bsf PORTA,0
movlw DlyaIND3_1
movwf PORTB
bsf PORTA,1
movlw DlyaIND2_1
movwf PORTB
bsf PORTA,2
BTFSS PORTB,7
return
VIVOD3 movlw DlyaIND4_2
movwf PORTB
bsf PORTA,0
movlw DlyaIND3_2
movwf PORTB
bsf PORTA,1
movlw DlyaIND2_2
movwf PORTB
bsf PORTA,2
BTFSS PORTB,7
return
VIVOD4 movlw DlyaIND4_3
movwf PORTB
bsf PORTA,0
movlw DlyaIND3_3
movwf PORTB
bsf PORTA,1
movlw DlyaIND2_3
movwf PORTB
bsf PORTA,2
BTFSS PORTB,7
return
START
Proverka2 btfsc PORTA,4
goto Proverka1
movf INDICATOR4,w
call tablica
movwf PORTB
movlw b'0001'
movwf PORTA
call delay;
bcf PORTA,0
movf INDICATOR3,w
call tablica
movwf PORTB
bsf PORTA,1
call delay;
bcf PORTA,1
movf INDICATOR2,w
call tablica
movwf PORTB
bsf PORTA,2
call delay
bcf PORTA,2
decfsz COUNT,F;0
goto START
movlw .30
movwf COUNT ;5
incf INDICATOR4,f
bcf STATUS,2
movlw .10
subwf INDICATOR4,w
btfsc STATUS,2
goto Obnulenie_4
goto START
delay
movlw .221
movwf Reg_1
movlw .13
movwf Reg_2
decfsz Reg_1,F
goto $-1
decfsz Reg_2,F
goto $-3
nop
nop
return
tablica addwf PCL,f
retlw b'01000000';0 ;return call
retlw b'11111001';1
retlw b'00100100';2
retlw b'00110000';3
retlw b'00011001';4
retlw b'00010010';5
retlw b'00000010';6
retlw b'11111000';7
retlw b'00000000';8
retlw b'00010000';9
Obnulenie_4 movlw .0
movwf INDICATOR4
incf INDICATOR3,f
bcf STATUS,2
movlw .6
subwf INDICATOR3,w
btfsc STATUS,2
goto Obnulenie_3
goto START
Obnulenie_3 clrf INDICATOR3
incf INDICATOR2,f
bcf STATUS,2
movlw .10
subwf INDICATOR2,w
btfsc STATUS,2
goto Obnulenie_2
goto START
Obnulenie_2 clrf INDICATOR2
goto START
end
- Вложения
-
- 1.png
- Сама схема секундомера
- (72.26 КБ) 629 скачиваний


