Hallo Leute
Programmiere gerade nen PIC16F876A und hab probleme mit der Displayansteuerung. Das RS-Pin wird gesetzt, aber sobald das Enable-Pin gesetzt wird, wird sofort das RS-Pin wieder gelöscht. Hab keine Idee woran es liegt (Betriebsblind). mit der Initialisierung klappt es ja, aber es zeigt einfach kein Text an.
Danke für eure hilfe!Code:;************************************************************** ;* ;* Pinbelegung ;* ---------------------------------- ;* PORTA: 0 ;* 1 ;* 2 E LC-Display ;* 3 RS LC-Display ;* 4 ;* 5 ;* ;* PORTB: 0 D0 LC-Display ;* 1 D1 LC-Display ;* 2 D2 LC-Display ;* 3 D3 LC-Display ;* 4 D4 LC-Display ;* 5 D5 LC-Display ;* 6 D6 LC-Display ;* 7 D7 LC-Display ;* ;* PORTC: 0 ;* 1 ;* 2 ;* 3 ;* 4 ;* 5 ;* 6 ;* 7 ;* ;************************************************************** ; ; Prozessortakt: 8 MHz ; Eingangsspannung: 0V ... 5V (Vss ... Vdd) ; ;************************************************************** ; Includedatei für den 16F876 einbinden list p=16f876 #include <P16f876A.INC> ERRORLEVEL -302 ;SUPPRESS BANK SELECTION MESSAGES __CONFIG _CP_OFF&_WRT_OFF&_CPD_OFF&_LVP_OFF&_BODEN_OFF&_PWRTE_ON&_WDT_OFF&_HS_OSC ;********************************************************** ; Variablen loops equ 0x20 loops2 equ 0x21 ZWISCH0 equ 0x22 ;Konstanten LCDD equ PORTB ; LCD-Daten-Port LcdE equ 2 ; enable Lcd LcdRS equ 3 ; Daten Lcd (nicht control) ; Anfangsinitialisierung init BSF STATUS,RP0 ; Bank1 movlw b'00000000' movwf TRISA movlw b'00000000' movwf TRISB movlw b'00000000' movwf TRISB BCF STATUS,RP0 ; Bank 0 call lcdinit ;********************************************************** ; Hauptprogrammschleife Main call anz goto Main ;********************************************************** ; Warteschleifen 1ms, 10ms, 15ms, 100ms, 250ms ;********************************************************** ; Warteschleife 1 ms wait1 movlw D'1' ; 1 ms Pause movwf loops goto wai ;********************************************************** ; Warteschleife 10 ms wait10 movlw D'10' ; 10 ms Pause movwf loops goto wai ;********************************************************** ; Warteschleife 15 ms wait15 movlw D'15' ; 15 ms Pause movwf loops goto wai ;********************************************************** ; Warteschleife 250 ms wait250 movlw D'250' ; 100 ms Pause movwf loops goto wai wai movlw .221 ; Zeitkonstante für 1ms movwf loops2 wai2 nop nop nop nop nop nop decfsz loops2, F ; 1 ms vorbei? goto wai2 ; nein, noch nicht ; decfsz loops, F ; 250 ms vorbei? goto wai ; nein, noch nicht return ; das Warten hat ein Ende ;********************************************************************************************** ; Vorbereitung des LCD: Portdefinition und Initialisierung ; RS = RA.3, E = RA.4 ;********************************************************************************************** lcdinit call wait15 bcf PORTA,LcdRS ; RS = 0: Steuerwort fuer Befehl schreiben movlw 01 ; Anweisung fuer Loeschen call ausgd movlw 02 ; Anweisung fuer: Display Ein, Cursor Aus call ausgd movlw 06 ; Anweisung fuer: Adresse erhoehen, nicht schieben, call ausgd movlw 38 ; Anweisung fuer: 8 bit-Worte, 2 Zeilen call ausgd ; und Zeichenformat 5 x 7 Pixel return ;********************************************************************************************** ; Ausgaberoutine fuer das LCD-Modul: Gibt Befehle bzw. Daten am LCD-Modul aus ;********************************************************************************************** ausg movwf LCDD bsf PORTA,LcdRS bsf PORTA,LcdE call wait10 bcf PORTA,LcdE call wait10 bcf PORTA,LcdRS return ausgd movwf LCDD call wait10 bcf PORTA,LcdRS bsf PORTA,LcdE call wait1 bcf PORTA,LcdE call wait10 return ;********************************************************************************************** ; LCD-Anzeige vorbereiten ;********************************************************************************************** zeile1 movlw 80 movwf ZWISCH0 goto einf zeile2 movlw 0C0 movwf ZWISCH0 goto einf einf movfw ZWISCH0 ; LCD-Adresse: call ausgd bsf PORTA,LcdRS return ;********************************************************** anzaus bcf PORTA,LcdRS movlw 08 call ausgd return ;********************************************************** anzein bcf PORTA,LcdRS movlw 0C call ausgd return ;********************************************************** anz call zeile1 movlw 'H' call ausg movlw 'a' call ausg movlw 'l' call ausg movlw 'l' call ausg movlw 'o' call ausg call wait250 return end ;**********************************************************
Skywalker







Zitieren

Lesezeichen