- Labornetzteil AliExpress         
Ergebnis 1 bis 2 von 2

Thema: Schieberegister fehlerhaft dank GLCD?

  1. #1
    Erfahrener Benutzer Fleißiges Mitglied
    Registriert seit
    23.03.2006
    Beiträge
    142

    Schieberegister fehlerhaft dank GLCD?

    Anzeige

    Powerstation Test
    Hallo,

    ich habe folgendes Problem...

    Ich habe mir einen ATMega32 mit einem GLCD inklusive TouchScreen aufgebaut... Das funktioniert soweit auch super inzwischen...

    Nun dachte ich mir das ich die Schaltung mit Schieberegistern (übungszwecke) erweitere... Dazu habe ich den 74HC595 laut Schaltplan verdratet...

    Ich nutze hierbei die 3 Pin variante, den Pin OE (13) habe ich auf VCC gelegt, da ich ihn nicht löschen brauch... (Kann man ja so einspeisen)

    Nun habe ich folgendes Problem:

    An Pin Q0 und Q1 habe ich eine Duo LED zum testen verbunden.

    Ich verwende folgenden Code zum Testen:

    Code:
    $regfile = "m32def.dat"
    $crystal = 16000000
    $baud = 38400
    
    $include "font8x8.font"
    
    $lib "glcdKS108.lbx"
    
    Config Graphlcd = 128 * 64sed , Dataport = Portc , Controlport = Portb , Ce = 0 , Ce2 = 1 , Cd = 2 , Rd = 3 , Reset = 5 , Enable = 4
    
    Config Adc = Single , Prescaler = Auto
    
    Config Porta.4 = Output
    Config Porta.5 = Output
    Config Porta.6 = Output
    
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    
    Reset Porta.6 : Set Porta.6 : Reset Porta.6
    
    Waitms 5000
    
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Set Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    
    Reset Porta.6 : Set Porta.6 : Reset Porta.6
    
    End
    Wie man am Code sehen kann ist die Daten-Leitung (DS) an Port A 4.
    Auf Port A 5 sende ich den Shift Befehl und mit A 6 soll das Register übernommen werden.

    Soweit so gut...

    ABER... Wenn ich die Schaltung so ausführe, leuchten von anfang an beide Farben der LED... Obwohl ich ja das Schieberegister gleich am Anfang direkt ausschalte und erst nach 5 Sekunden Pin Q0 einschalte...

    Ich habe herrausgefunden, dass es anscheinend an der Definition des GLCD zutun hat... Ändere ich den Code so ab:

    Code:
    $regfile = "m32def.dat"
    $crystal = 16000000
    $baud = 38400
    
    $include "font8x8.font"
    
    $lib "glcdKS108.lbx"
    
    Config Adc = Single , Prescaler = Auto
    
    Config Porta.4 = Output
    Config Porta.5 = Output
    Config Porta.6 = Output
    
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    
    Reset Porta.6 : Set Porta.6 : Reset Porta.6
    
    Waitms 5000
    
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Reset Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    Set Porta.4 : Reset Porta.5 : Set Porta.5 : Reset Porta.5
    
    Reset Porta.6 : Set Porta.6 : Reset Porta.6
    
    Config Graphlcd = 128 * 64sed , Dataport = Portc , Controlport = Portb , Ce = 0 , Ce2 = 1 , Cd = 2 , Rd = 3 , Reset = 5 , Enable = 4
    
    End
    Dann scheint alles super zu funktionieren... Beim Laden des ATMega32 geht sofort die LED aus und nach 5 Sekunden dann die Grüne LED an...
    So wie es geplant war...

    Kann mir jemand sagen, wie ich das hin bekomme, dass ich das Schieberegister auch unterhalb der Definition des GLCD bedienen kann? Weil so ist das irgendwie etwas doof *g*

    Ich hoffe ihr könnt mir bei dem Problem helfen und findet den Fehler evtl!

    Danke euch!

    MFG

    Michael
    Mit freundlichen Grüssen

    Michael

  2. #2
    Erfahrener Benutzer Robotik Einstein Avatar von Jaecko
    Registriert seit
    16.10.2006
    Ort
    Lkr. Rottal/Inn
    Alter
    41
    Beiträge
    2.009
    Schmeiss mal die $include "font8x8.font" ganz runter als letzte Zeile.
    Hatte exakt das gleiche Problem mit diesem Display und nem Funkmodul.
    Ohne GLCD liefs, mit dem nicht mehr.
    Nach langer Suche hab ich rausgefunden, dass die Zeile mit der Schrift da stört. Ist die ganz am Ende, klappts problemlos.
    Warum, weiss der Teufel... und der wohl nicht mal genau.
    #ifndef MfG
    #define MfG

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •  

fchao-Sinus-Wechselrichter AliExpress