Code:
DispSet clrf TB1 ;alle Segmente an
clrf TB2
clrf TB3
clrf TC1
clrf TC2
clrf TC3
bcf _Fnz
bsf DATE ;diese Segmente aus
bsf START
movlw D3 ;alle Segmente für Display festlegen
movwf FSR
movf INDF,0
movwf DTmp
movf DTmp,1
btfss _Z
goto $+3
bsf dp
incf FSR,1
movlw 7
movwf PCLATH
swapf INDF,0
andlw 0F
movwf DTmp
movf DTmp,1
btfss _Z
bsf _Fnz
btfsc _Fnz
goto SetDig6
goto Dig6A
Digit5 movlw 7
movwf PCLATH
movf INDF,0
andlw 0F
movwf DTmp
movf DTmp,1
btfss _Z
bsf _Fnz
btfsc _Fnz
goto SetDig5
goto Dig5A
Digit4 incf FSR,1
movlw 7
movwf PCLATH
swapf INDF,0
andlw 0F
movwf DTmp
movf DTmp,1
btfss _Z
bsf _Fnz
btfsc _Fnz
goto SetDig4
goto Dig4A
Digit3 movlw 7
movwf PCLATH
movf INDF,0
andlw 0F
movwf DTmp
movf DTmp,1
btfss _Z
bsf _Fnz
btfsc _Fnz
goto SetDig3
goto Dig3A
Digit2 incf FSR,1
movlw 7
movwf PCLATH
swapf INDF,0
andlw 0F
movwf DTmp
movf DTmp,1
btfss _Z
bsf _Fnz
btfsc _Fnz
goto SetDig2
goto Dig2A
Digit1 movlw 7
movwf PCLATH
movf INDF,0
andlw 0F
goto SetDig1
Dig60 bsf g6
goto Digit5
Dig61 bsf a6
bsf b6
bsf c6
bsf d6
bsf g6
goto Digit5
Dig62 bsf c6
bsf f6
goto Digit5
Dig63 bsf b6
bsf c6
goto Digit5
Dig64 bsf a6
bsf b6
bsf d6
goto Digit5
Dig65 bsf b6
bsf e6
goto Digit5
Dig66 bsf e6
goto Digit5
Dig67 bsf a6
bsf b6
bsf c6
bsf g6
goto Digit5
Dig68 goto Digit5
Dig69 bsf b6
goto Digit5
Dig6A bsf a6
bsf b6
bsf c6
bsf d6
bsf e6
bsf f6
bsf g6
goto Digit5
Dig50 bsf g5
goto Digit4
Dig51 bsf a5
bsf b5
bsf c5
bsf d5
bsf g5
goto Digit4
Dig52 bsf c5
bsf f5
goto Digit4
Dig53 bsf b5
bsf c5
goto Digit4
Dig54 bsf a5
bsf b5
bsf d5
goto Digit4
Dig55 bsf b5
bsf e5
goto Digit4
Dig56 bsf e5
goto Digit4
Dig57 bsf a5
bsf b5
bsf c5
bsf g5
goto Digit4
Dig58 goto Digit4
Dig59 bsf b5
goto Digit4
Dig5A bsf a5
bsf b5
bsf c5
bsf d5
bsf e5
bsf f5
bsf g5
goto Digit4
Dig40 bsf g4
goto Digit3
Dig41 bsf a4
bsf b4
bsf c4
bsf d4
bsf g4
goto Digit3
Dig42 bsf c4
bsf f4
goto Digit3
Dig43 bsf b4
bsf c4
goto Digit3
Dig44 bsf a4
bsf b4
bsf d4
goto Digit3
Dig45 bsf b4
bsf e4
goto Digit3
Dig46 bsf e4
goto Digit3
Dig47 bsf a4
bsf b4
bsf c4
bsf g4
goto Digit3
Dig48 goto Digit3
Dig49 bsf b4
goto Digit3
Dig4A bsf a4
bsf b4
bsf c4
bsf d4
bsf e4
bsf f4
bsf g4
goto Digit3
Dig30 bsf g3
goto Digit2
Dig31 bsf a3
bsf b3
bsf c3
bsf d3
bsf g3
goto Digit2
Dig32 bsf c3
bsf f3
goto Digit2
Dig33 bsf b3
bsf c3
goto Digit2
Dig34 bsf a3
bsf b3
bsf d3
goto Digit2
Dig35 bsf b3
bsf e3
goto Digit2
Dig36 bsf e3
goto Digit2
Dig37 bsf a3
bsf b3
bsf c3
bsf g3
goto Digit2
Dig38 goto Digit2
Dig39 bsf b3
goto Digit2
Dig3A bsf a3
bsf b3
bsf c3
bsf d3
bsf e3
bsf f3
bsf g3
goto Digit2
Dig20 bsf g2
goto Digit1
Dig21 bsf a2
bsf b2
bsf c2
bsf d2
bsf g2
goto Digit1
Dig22 bsf c2
bsf f2
goto Digit1
Dig23 bsf b2
bsf c2
goto Digit1
Dig24 bsf a2
bsf b2
bsf d2
goto Digit1
Dig25 bsf b2
bsf e2
goto Digit1
Dig26 bsf e2
goto Digit1
Dig27 bsf a2
bsf b2
bsf c2
bsf g2
goto Digit1
Dig28 goto Digit1
Dig29 bsf b2
goto Digit1
return
Dig2A bsf a2
bsf b2
bsf c2
bsf d2
bsf e2
bsf f2
bsf g2
goto Digit1
Dig10 bsf g1
return
Dig11 bsf a1
bsf b1
bsf c1
bsf d1
bsf g1
return
Dig12 bsf c1
bsf f1
return
Dig13 bsf b1
bsf c1
return
Dig14 bsf a1
bsf b1
bsf d1
return
Dig15 bsf b1
bsf e1
return
Dig16 bsf e1
return
Dig17 bsf a1
bsf b1
bsf c1
bsf g1
return
Dig18 return
Dig19 bsf b1
return
DispLoop movf PA,0 ;endlose Displayschleife
movwf PORTA
movf PB,0
movwf PORTB
movf PC,0
movwf PORTC
movf TA1,0 ;Com1
andlw 0xFB
bsf _RP0
movwf TRISA
bcf _RP0
movf TB1,0
bsf _RP0
movwf TRISB
bcf _RP0
movf TC1,0
bsf _RP0
movwf TRISC
bcf _RP0
call Del ;Dauer vom Com1
movf TA2,0 ;Com2
andlw 0xFD
bsf _RP0
movwf TRISA
bcf _RP0
movf TB2,0
bsf _RP0
movwf TRISB
bcf _RP0
movf TC2,0
bsf _RP0
movwf TRISC
bcf _RP0
call Del ;Dauer vom Com2
movf TA3,0 ;Com3
andlw 0xFE
bsf _RP0
movwf TRISA
bcf _RP0
movf TB3,0
bsf _RP0
movwf TRISB
bcf _RP0
movf TC3,0
bsf _RP0
movwf TRISC
bcf _RP0
call Del ;Dauer vom Com3
bcf _Ftmp ;alle Signale invertieren
btfss PA,4
bsf _Ftmp
comf PA,1
bcf PA,4
btfss _Ftmp
bsf PA,4
comf PB,1
comf PC,1
goto DispLoop
Del movlw 0C ;Verzögerungsschleife ca. 5ms
movwf DTmp1
clrf DTmp
decfsz DTmp,1
goto $-1
decfsz DTmp1,1
goto $-4
return
Init clrf ADCON0 ;schalte ADC aus
movlw 7 ;sperre ADC
movwf ADCON1 ;und definiere A0-A7 als digitale I/Os
clrf PORTA ;Registerwerte vorm Start festlegen
clrf PORTB
clrf PORTC
clrf Flags
call AClr
movlw 7
movwf PA
clrf PB
clrf PC
movlw 0xFB
movwf TA1
movlw 0xFD
movwf TA2
movlw 0xFE
movwf TA3
bsf _RP0 ;Bank 1
movlw 7 ;sperre ADC
movwf ADCON1 ;und definiere A0-A7 als digitale I/Os
movlw 0xFF
movwf TRISA ;alle PORTA Pins als Eingänge
movlw 27 ;Takt für Timer0 vom T0CKI Pin usw.
movwf OPTION_REG ;Timer0 konfigurieren
bsf PIE1,TMR1IE ;TMR1 interrupt erlauben
bcf _RP0 ;Bank 0
movlw 0xE0 ;GIE, PEIE & TMR0IE erlauben
movwf INTCON
goto TMRStart ;beide Timer starten
org 7A0
SetDig6 addwf PCL,1
goto Dig60
goto Dig61
goto Dig62
goto Dig63
goto Dig64
goto Dig65
goto Dig66
goto Dig67
goto Dig68
goto Dig69
org 7B0
SetDig5 addwf PCL,1
goto Dig50
goto Dig51
goto Dig52
goto Dig53
goto Dig54
goto Dig55
goto Dig56
goto Dig57
goto Dig58
goto Dig59
org 7C0
SetDig4 addwf PCL,1
goto Dig40
goto Dig41
goto Dig42
goto Dig43
goto Dig44
goto Dig45
goto Dig46
goto Dig47
goto Dig48
goto Dig49
org 7D0
SetDig3 addwf PCL,1
goto Dig30
goto Dig31
goto Dig32
goto Dig33
goto Dig34
goto Dig35
goto Dig36
goto Dig37
goto Dig38
goto Dig39
org 7E0
SetDig2 addwf PCL,1
goto Dig20
goto Dig21
goto Dig22
goto Dig23
goto Dig24
goto Dig25
goto Dig26
goto Dig27
goto Dig28
goto Dig29
org 7F0
SetDig1 addwf PCL,1
goto Dig10
goto Dig11
goto Dig12
goto Dig13
goto Dig14
goto Dig15
goto Dig16
goto Dig17
goto Dig18
goto Dig19
end
Lesezeichen