|
; Programm fur digitale Drehzahlanzeige V1.0 mit 16F874; (C) Johannes Walk;; Für PIC16F874; Osc: Quartz, HS, 20MHz 30pF; Mit Funktionstest und SPIKE-Unterdrückung; Eingang: 100k auf 5,1V-ZD (0,5W) und 10nF gen GND in PORTA,0; Ausgänge: ab PORTA,1 32 OUT's aufsteigend; Anzeige: ab 0 RPM in 250 RPM-Schritten, aufsteigend, Balkenanz. LIST P=PIC16F874 ; Include file include DZ00 equ 0x70DZ01 equ 0x71DZ02 equ 0x72DZ03 equ 0x73TIMEREG1 equ 0x60EINGREG equ 0x61 goto Definitionen TEST clrf TIMEREG1tests1 call TESTT btfss PORTE,2 goto tests1tests2 call TESTT btfsc PORTE,2 goto tests2 call RESET call DISPLAY RETURN TESTT clrwdt btfss INTCON,2 ; TMR0 taşması, 1Bit için RETURN bcf INTCON,2 decfsz TIMEREG1,f RETURN movlw 0x60 movwf TIMEREG1 call ROTATE call DISPLAY RETURN TIMER clrwdt btfss INTCON,2 ; TMR0 taşması, 1Bit için RETURN bcf INTCON,2 decfsz TIMEREG1,f RETURN movlw 0x92 ;3D=61(20MHz),0,05 sn (20,01 Hz Bölümü faktörü) movwf TIMEREG1 call DISPLAY ; Ne zaman bitti: RESET... call RESET call ROTATE RETURN EINGANG btfsc PORTA,0 goto e01e00 ;Eingang=0 bcf EINGREG,0 RETURNe01 ;Eingang=1 btfss EINGREG,0 call FLANK bsf EINGREG,0 RETURN FLANK call ROTATE RETURN ROTATE RLF DZ00,f bsf DZ00,0 RLF DZ01,f RLF DZ02,f RLF DZ03,f RETURN RESET clrf DZ00 clrf DZ01 clrf DZ02 clrf DZ03 RETURN DISPLAY clrf PORTA btfss DZ00,0 bsf PORTA,1 btfss DZ00,1 bsf PORTA,2 btfss DZ00,2 bsf PORTA,3 btfss DZ00,3 bsf PORTA,4 btfss DZ00,4 bsf PORTA,5 clrf PORTB btfss DZ00,5 bsf PORTB,0 btfss DZ00,6 bsf PORTB,1 btfss DZ00,7 bsf PORTB,2 btfss DZ01,0 bsf PORTB,3 btfss DZ01,1 bsf PORTB,4 btfss DZ01,2 bsf PORTB,5 btfss DZ01,3 bsf PORTB,6 btfss DZ01,4 bsf PORTB,7 clrf PORTC btfss DZ01,5 bsf PORTC,0 btfss DZ01,6 bsf PORTC,1 btfss DZ01,7 bsf PORTC,2 btfss DZ02,0 bsf PORTC,3 btfss DZ02,1 bsf PORTC,4 btfss DZ02,2 bsf PORTC,5 btfss DZ02,3 bsf PORTC,6 btfss DZ02,4 bsf PORTC,7 clrf PORTD btfss DZ02,5 bsf PORTD,0 btfss DZ02,6 bsf PORTD,1 btfss DZ02,7 bsf PORTD,2 btfss DZ03,0 bsf PORTD,3 btfss DZ03,1 bsf PORTD,4 btfss DZ03,2 bsf PORTD,5 btfss DZ03,3 bsf PORTD,6 btfss DZ03,4 bsf PORTD,7 clrf PORTE btfss DZ03,5 bsf PORTE,0 btfss DZ03,6 bsf PORTE,1 btfss DZ03,7 bsf PORTE,2 RETURN Definitionen ; Allg. Temel Tanımlar clrw clrwdt BANKSEL TMR0 clrf PORTA clrf PORTB clrf PORTC clrf PORTD clrf PORTE BANKSEL OPTION_REG movlw b'00000000' movwf ADCON0 movlw b'00000111' movwf ADCON1 movlw b'00000001' movwf TRISA movlw b'00000000' movwf TRISB movlw b'00000000' movwf TRISC movlw b'00000000' movwf TRISD movlw b'00000000' movwf TRISE clrf INTCON movlw b'00000011' movwf OPTION_REG clrwdt BANKSEL TMR0 clrf PORTA clrf PORTB clrf PORTC clrf PORTD clrf PORTE clrf DZ00 clrf DZ01 clrf DZ02 clrf DZ03 clrf TIMEREG1 call TEST Main clrwdt call TIMER call EINGANG goto Main END |
|
Hiç yorum yok:
Yorum Gönder