list p=16F84 ; PIC16F84 mit 4 Mhz Takt #include ; Configuration festlegen: ; Power on Timer, kein Watchdog, XT-Oscillator __CONFIG _PWRTE_ON & _WDT_OFF & _XT_OSC ; Variablen festlegen loop equ 0x13 loops equ 0x14 loops2 equ 0x15 letter equ 0x16 lcount equ 0x17 dsend equ 0x18 dcount equ 0x19 rowcount equ 0x1A rock equ 0x1B ; Konstanten festlegen #define CLK PORTB,7 ;Clock für das Schieberegister #define DATA PORTB,6 ;Serielle Datenausgabe #define STROBE PORTB,5 ;Daten auf die Ausgänge durchschalten #define OE PORTB,4 ;Output Enable ; ************* Initalisierung ********************************** Init bsf STATUS, RP0 ; auf Bank 1 umschalten movlw B'00000000' ; 0 ins w, dann nach TRISB & TRISA, PORTB & PORTA alle Output movwf TRISB movwf TRISA bcf STATUS, RP0 ; auf Bank 0 zurückschalten movlw .0 movwf PORTB ; alle Ports auf LOW movwf PORTA clrf loop ; alle Variablen clear clrf loops clrf loops2 clrf letter clrf lcount clrf dsend clrf dcount clrf rowcount clrf rock ; ************ Hauptprogramm ************************************ main movlw .5 movwf rowcount movlw .8 movwf letter call zerobits maybe1 movlw .8 movwf lcount ;Zähler für 8 Ziffern bcf STROBE ;Clear Strobe für saubere Anzeige call row ;Zeile festlegen call lowled4 ;4 LEDs ausschalten maybe2 call table_read ;Tabelle nach Buchstaben auslesen(PCL Problem) call data_send ; 8Bit Wert aus der Tabelle senden call next_letter decfsz lcount,f goto maybe2 call lowled3 bsf STROBE call next_row call next_letter call Wait call Wait goto maybe1 ;zerobits ****************************************************** zerobits movlw .0 movwf dsend movlw .81 movwf dcount bcf DATA call data_loop bsf STROBE bsf OE call Wait bcf STROBE call Wait return ;zerobits ******************************************************* ;row ************************************************************ row movf rowcount,w call rowpcl btfsc rock,1 goto rowreturn movwf dsend call data_send bcf DATA bsf CLK nop bcf CLK rowreturn clrf rock return ;row ************************************************************ ;rowpcl ********************************************************* rowpcl addwf PCL, f retlw .1 ;Zeile9 retlw .2 ;Zeile8 retlw .4 ;Zeile7 retlw .8 ;Zeile6 retlw .16 ;Zeile5 retlw .32 ;Zeile4 retlw .64 ;Zeile3 retlw .128 ;Zeile2 call row1 ;Zeile1 return ;rowpcl ********************************************************* ;row1 *********************************************************** row1 movlw .0 movwf dsend call data_send bsf DATA bsf CLK nop bcf CLK movlw .255 movwf rock return ;row1 ************************************************************ ;lowled4 ********************************************************* lowled4 movlw .0 movwf dsend movlw .4 movwf dcount bcf DATA call data_loop return ;lowled4 ******************************************************** ;table_read ***************************************************** table_read ;######################## movf rowcount,w ;#### PCL überlauft ##### call table_row ;#### hier und das ###### addwf PCL, f ;#### Problem für mich ## call Zeile9 ;#### beginnt :( ######## return ;######################## call Zeile8 return call Zeile7 return call Zeile6 return call Zeile5 return call Zeile4 return call Zeile3 return call Zeile2 return call Zeile1 return ;table_read ***************************************************** ;table_row ****************************************************** table_row addwf PCL, f retlw .0 ;Zeile9 retlw .2 ;Zeile8 retlw .4 ;Zeile7 retlw .6 ;Zeile6 retlw .8 ;Zeile5 retlw .10 ;Zeile4 retlw .12 ;Zeile3 retlw .14 ;Zeile2 retlw .16 ;Zeile1 ;table_row ****************************************************** ;lowled3 ******************************************************** lowled3 movlw .0 movwf dsend movlw .3 movwf dcount bcf DATA call data_loop return ;lowled3 ******************************************************** ;next_row ******************************************************* next_row decfsz rowcount,f goto rnull goto rback rnull movlw .9 movwf rowcount rback return ;next_row ******************************************************* ;next_letter **************************************************** next_letter decfsz letter,f goto lnull goto lback lnull movlw .8 movwf letter lback return ;next_letter **************************************************** ; ************ Daten ausgeben an Schieberegister **************** data_send movlw .8 movwf dcount bcf DATA data_loop bsf CLK btfss dsend,8 goto d_next1 bsf DATA goto d_next2 d_next1 bcf DATA d_next2 nop bcf CLK rrf dsend,f decfsz dcount,f goto data_loop bcf DATA return ; Beginn der Tabelle für Großbuchstaben ************************* Zeile1 addwf PCL, f retlw B'00000000' ;Leerzeichen retlw B'00011000' ;A retlw B'01111100' ;B retlw B'00011000' ;C retlw B'01111000' ;D retlw B'01111110' ;E retlw B'01111110' ;F retlw B'00011000' ;G retlw B'01100110' ;H retlw B'00011000' ;I retlw B'01111110' ;J retlw B'01100110' ;K retlw B'01100000' ;L retlw B'11101110' ;M retlw B'01100110' ;N retlw B'00011000' ;O retlw B'01111100' ;P retlw B'00011000' ;Q retlw B'01111000' ;R retlw B'00011000' ;S retlw B'01111110' ;T retlw B'01100110' ;U retlw B'01100110' ;V retlw B'11000110' ;W retlw B'01100110' ;X retlw B'01100110' ;Y retlw B'01111110' ;Z retlw B'01100110' ;Ä retlw B'01100110' ;Ü retlw B'01100110' ;Ö Zeile2 addwf PCL, f retlw B'00000000' ;Leerzeichen retlw B'00111100' ;A retlw B'01111110' ;B retlw B'00111100' ;C retlw B'01111100' ;D retlw B'01111110' ;E retlw B'01111110' ;F retlw B'00111100' ;G retlw B'01100110' ;H retlw B'00011000' ;I retlw B'01111110' ;J retlw B'01100110' ;K retlw B'01100000' ;L retlw B'11111110' ;M retlw B'01110110' ;N retlw B'00111100' ;O retlw B'01111110' ;P retlw B'00111100' ;Q retlw B'01111100' ;R retlw B'00111100' ;S retlw B'01111110' ;T retlw B'01100110' ;U retlw B'01100110' ;V retlw B'11000110' ;W retlw B'01100110' ;X retlw B'01100110' ;Y retlw B'01111110' ;Z retlw B'00011000' ;Ä retlw B'00000000' ;Ü retlw B'00011000' ;Ö Zeile3 addwf PCL, f retlw B'00000000' ;Leerzeichen retlw B'01100110' ;A retlw B'01100110' ;B retlw B'01100110' ;C retlw B'01100110' ;D retlw B'01100000' ;E retlw B'01100000' ;F retlw B'00111100' ;G retlw B'01100110' ;H retlw B'00011000' ;I retlw B'00000110' ;J retlw B'01100110' ;K retlw B'01100000' ;L retlw B'11010110' ;M retlw B'01110110' ;N retlw B'01100110' ;O retlw B'01100110' ;P retlw B'01100110' ;Q retlw B'01100110' ;R retlw B'01100110' ;S retlw B'00011000' ;T retlw B'01100110' ;U retlw B'01100110' ;V retlw B'11000110' ;W retlw B'01100110' ;X retlw B'01100110' ;Y retlw B'00000110' ;Z retlw B'00111100' ;Ä retlw B'01100110' ;Ü retlw B'00111100' ;Ö Zeile4 addwf PCL, f retlw B'00000000' ;Leerzeichen retlw B'01100110' ;A retlw B'01100110' ;B retlw B'01100000' ;C retlw B'01100110' ;D retlw B'01100000' ;E retlw B'01100000' ;F retlw B'01100000' ;G retlw B'01111110' ;H retlw B'00011000' ;I retlw B'00000110' ;J retlw B'01101100' ;K retlw B'01100000' ;L retlw B'11000110' ;M retlw B'01110110' ;N retlw B'01100110' ;O retlw B'01100110' ;P retlw B'01100110' ;Q retlw B'01100110' ;R retlw B'01100000' ;S retlw B'00011000' ;T retlw B'01100110' ;U retlw B'01100110' ;V retlw B'11010110' ;W retlw B'00111100' ;X retlw B'01100110' ;Y retlw B'00001100' ;Z retlw B'01100110' ;Ä retlw B'01100110' ;Ü retlw B'01100110' ;Ö Zeile5 addwf PCL, f retlw B'00000000' ;Leerzeichen retlw B'01111110' ;A retlw B'01111100' ;B retlw B'01100000' ;C retlw B'01100110' ;D retlw B'01111100' ;E retlw B'01111100' ;F retlw B'01101110' ;G retlw B'01111110' ;H retlw B'00011000' ;I retlw B'00000110' ;J retlw B'01111000' ;K retlw B'01100000' ;L retlw B'11000110' ;M retlw B'01111110' ;N retlw B'01100110' ;O retlw B'01111110' ;P retlw B'01100110' ;Q retlw B'01111100' ;R retlw B'00111100' ;S retlw B'00011000' ;T retlw B'01100110' ;U retlw B'01100110' ;V retlw B'11010110' ;W retlw B'00011000' ;X retlw B'00111100' ;Y retlw B'00011000' ;Z retlw B'01100110' ;Ä retlw B'01100110' ;Ü retlw B'01100110' ;Ö Zeile6 addwf PCL, f retlw B'00000000' ;Leerzeichen retlw B'01111110' ;A retlw B'01100110' ;B retlw B'01100000' ;C retlw B'01100110' ;D retlw B'01100000' ;E retlw B'01111100' ;F retlw B'01100110' ;G retlw B'01100110' ;H retlw B'00011000' ;I retlw B'00000110' ;J retlw B'01101100' ;K retlw B'01100000' ;L retlw B'11000110' ;M retlw B'01101110' ;N retlw B'01100110' ;O retlw B'01111100' ;P retlw B'01100110' ;Q retlw B'01111000' ;R retlw B'00000110' ;S retlw B'00011000' ;T retlw B'01100110' ;U retlw B'01100110' ;V retlw B'11010110' ;W retlw B'00111100' ;X retlw B'00011000' ;Y retlw B'00110000' ;Z retlw B'01111110' ;Ä retlw B'01100110' ;Ü retlw B'01100110' ;Ö Zeile7 addwf PCL, f retlw B'00000000' ;Leerzeichen retlw B'01100110' ;A retlw B'01100110' ;B retlw B'01100110' ;C retlw B'01100110' ;D retlw B'01100000' ;E retlw B'01100000' ;F retlw B'01100110' ;G retlw B'01100110' ;H retlw B'00011000' ;I retlw B'01100110' ;J retlw B'01100000' ;L retlw B'01100110' ;K retlw B'11000110' ;M retlw B'01101110' ;N retlw B'01100110' ;O retlw B'01100000' ;P retlw B'01101110' ;Q retlw B'01101100' ;R retlw B'01100110' ;S retlw B'00011000' ;T retlw B'01100110' ;U retlw B'00100100' ;V retlw B'00111100' ;W retlw B'01100110' ;X retlw B'00011000' ;Y retlw B'01100000' ;Z retlw B'01111110' ;Ä retlw B'01100110' ;Ü retlw B'01100110' ;Ö Zeile8 addwf PCL, f retlw B'00000000' ;Leerzeichen retlw B'01100110' ;A retlw B'01111110' ;B retlw B'00111100' ;C retlw B'01111100' ;D retlw B'01111110' ;E retlw B'01100000' ;F retlw B'00111100' ;G retlw B'01100110' ;H retlw B'00011000' ;I retlw B'00111100' ;J retlw B'01100110' ;K retlw B'01111110' ;L retlw B'11000110' ;M retlw B'01100110' ;N retlw B'00111100' ;O retlw B'01100000' ;P retlw B'00111100' ;Q retlw B'01100110' ;R retlw B'00111100' ;S retlw B'00011000' ;T retlw B'00111100' ;U retlw B'00111100' ;V retlw B'01101100' ;W retlw B'01100110' ;X retlw B'00011000' ;Y retlw B'01111110' ;Z retlw B'01100110' ;Ä retlw B'00111100' ;Ü retlw B'00111100' ;Ö Zeile9 addwf PCL, f retlw B'00000000' ;Leerzeichen retlw B'01100110' ;A retlw B'01111100' ;B retlw B'00011000' ;C retlw B'01111000' ;D retlw B'01111110' ;E retlw B'01100000' ;F retlw B'00011000' ;G retlw B'01100110' ;H retlw B'00011000' ;I retlw B'00011000' ;J retlw B'01100110' ;K retlw B'01111110' ;L retlw B'11000110' ;M retlw B'01100110' ;N retlw B'00011000' ;O retlw B'01100000' ;P retlw B'00011010' ;Q retlw B'01100110' ;R retlw B'00011000' ;S retlw B'00011000' ;T retlw B'00011000' ;U retlw B'00011000' ;V retlw B'00101000' ;W retlw B'01100110' ;X retlw B'00011000' ;Y retlw B'01111110' ;Z retlw B'01100110' ;Ä retlw B'00011000' ;Ü retlw B'00011000' ;Ö ; Ende der Tabelle für Großbuchstaben *************************** ; ************ Warteschleifen *********************************** ; Warteschleife für 500ms Wait500 movlw .2 ;2mal die 250ms Warteschleife movwf loop Wai500 call Wait250 ;250ms Warteschleife aufrufen decfsz loop, F ;2mal die 250ms Warteschleife durch? goto Wai500 ;nein, noch nicht return ;Ende mit 500ms ; Warteschleife für 250ms Wait250 movlw .250 ;250ms warten movwf loops Wai250 call Wait decfsz loops, F ;250ms vorbei? goto Wai250 ;nein, noch nicht return ;Ende mit 250ms ; Zeitkonstante für 1ms Wait movlw .110 movwf loops2 Wait2 nop nop nop nop nop nop decfsz loops2, F ;1ms vorbei? goto Wait2 ;nein, noch nicht return ;Ende mit 1ms ; ENDE der Warteschleifen *************************************** end