LCD 20x4 initiering

Övriga diskussioner relaterade till komponenter. Exempelvis radiorör, A/D, kontaktdon eller sensorer.
Fisherman
Inlägg: 35
Blev medlem: 1 februari 2008, 16:32:20
Ort: DJURHAMN

LCD 20x4 initiering

Inlägg av Fisherman »

Patienten
Resized_20180106_153643.jpeg
Får inte igång denna display - har från nätet provat ett par varianter med 4-bit initiering utan framgång.
Har använt denna tidigare (7-8 år sedan) men har inte kvar kod eller datablad och hittar inte just denna på nätet.
Har för mig att det var någon fix med seriemotstånd ...?

Kör LCDn på +5V från en ESP8266-1 via 8-bit expander MCP23008

Help please

/Stefan på Djurö
Du har inte behörighet att öppna de filer som bifogats till detta inlägg.
Castor
Inlägg: 1981
Blev medlem: 24 mars 2012, 13:03:49

Re: LCD 20x4 initiering

Inlägg av Castor »

De flesta sådana displayer brukar ha en controller kompatibel med Hitachi? HD44780, sök på den och använd den startrutinen. Det brukar vara petigt med minimitiderna vid starten, och om jag kommer ihåg rätt kör man någon slags initiering med samma instruktion 3 ggr innan man kan ge vanliga kommandon.
Fisherman
Inlägg: 35
Blev medlem: 1 februari 2008, 16:32:20
Ort: DJURHAMN

Re: LCD 20x4 initiering

Inlägg av Fisherman »

Castor:
Har kollat HD44780 och sökte vidare med detta resultat:
"The main benefit of the 4 bit mode is that less data lines are required. In this mode D3 to D0 are tied to ground and data/commands are transferred 1, 4 bit nibble at a time."

Värmer lödkolven - men ingen skillnad

/stefan
Användarvisningsbild
TomasL
EF Sponsor
Inlägg: 45173
Blev medlem: 23 september 2006, 23:54:55
Ort: Borås
Kontakt:

Re: LCD 20x4 initiering

Inlägg av TomasL »

Den är baserad på KS0107 chipet.
Följande kommer från http://gemtech.itgo.com/spec/index.htm
Du har inte behörighet att öppna de filer som bifogats till detta inlägg.
Castor
Inlägg: 1981
Blev medlem: 24 mars 2012, 13:03:49

Re: LCD 20x4 initiering

Inlägg av Castor »

Jag har för mig att man loopade 3 ggr i början för att säkerställa rätt inställning, skrev en initiering för 8051 för länge sen, den funkade så jag pillade aldrig i den. WIKI håller med:

The following algorithm ensures that the LCD is in the desired mode:

Set D7-D4 to 0b0011, and toggle the enable bit.
If in State1, the LCD will see the command as 0b0011_0000, and thus remain in 8-bit mode (State1).
If in State2, the LCD will simply latch the value 0b0011 into bits 7-4 and then move to State3.
If in State3, the LCD will latch the value 0b0011 into bits 3-0, and then execute a random command based on the (unknown to us) values in bits 7-4, after which it will either be in State1 (if the unknown bits happened to be 0b0011), or State2 (if the unknown bits were anything else).
Repeat the above, setting D7-D4 to 0b0011 and toggling the enable bit again.
If in State1, the LCD will remain in 8-bit mode (State1) just as above.
If in State2, it will latch the value into bits 7-4 and move to State3, just as above.
If in State3, the LCD will latch the value into bits 3-0 just as above and execute a command. However, the command will no longer be random, but will be the 0b0011 that was latched from State2 in the previous iteration. Thus, the LCD will switch to 8-bit mode and change to State1.
The LCD is now in either State1 or State 3. Repeat the previous step one more time.
If in State1, the LCD will remain in 8-bit mode (and thus State1).
The LCD can no longer be in State2 at this point.
If in State3, the LCD will latch the value into bits 3-0 and execute a command, which will be the 0b0011 that was latched from State2 in the previous iteration, thus switching the LCD to 8-bit mode and State1.
Now that the LCD is definitely in 8-bit mode, it can be switched to 4-bit mode if desired. To do so, set D7-D4 to 0b0010 and toggle the enable bit. This will leave the LCD in 4-bit mode, configured for a single line and 5x8 fonts.
Issue any desired additional Function Set commands to specify the number of lines and the font to use, being sure to use the appropriate value for bit 4 so as to remain in the desired mode (0 for 4-bit and 1 for 8-bit).

Once in 4-bit mode, character and control data are transferred as pairs of 4-bit "nibbles" on the upper data pins, D7-D4. The four most significant bits (7-4) must be written first, followed by the four least significant bits (3-0).
Användarvisningsbild
sodjan
EF Sponsor
Inlägg: 43149
Blev medlem: 10 maj 2005, 16:29:20
Ort: Söderköping
Kontakt:

Re: LCD 20x4 initiering

Inlägg av sodjan »

För att förtydliga lite...

Om det nu *är* en KS0107 baserad display, så är det en *grafisk*
LCD och den är absolut *inte* kompatibel med HD44780!

I databladet som Tomas länkade till står det däremot KS0066U, och
*det* är däremot en HD44780 kompatibel controller...
Castor
Inlägg: 1981
Blev medlem: 24 mars 2012, 13:03:49

Re: LCD 20x4 initiering

Inlägg av Castor »

My bad, läste inte Tomas L:s inlägg, då är det inte lönt att initiera en HD44780. :D
Användarvisningsbild
TomasL
EF Sponsor
Inlägg: 45173
Blev medlem: 23 september 2006, 23:54:55
Ort: Borås
Kontakt:

Re: LCD 20x4 initiering

Inlägg av TomasL »

sodjan skrev:För att förtydliga lite...

Om det nu *är* en KS0107 baserad display, så är det en *grafisk*
LCD och den är absolut *inte* kompatibel med HD44780!

I databladet som Tomas länkade till står det däremot KS0066U, och
*det* är däremot en HD44780 kompatibel controller...
My bad jag läste fel på hemsidan, det är naturligtvis en KS0060.
Fisherman
Inlägg: 35
Blev medlem: 1 februari 2008, 16:32:20
Ort: DJURHAMN

Re: LCD 20x4 initiering

Inlägg av Fisherman »

Jo jag har koll på KS0066U spec nu men får det inte att funka.
Provade med en annan gammal 16x2 raders - då brände jag MCP23008.

Jag ger upp och slänger de gamla 5V parallella LCD erna och håller mig till oled mfl med I2C eller SPI i 3,3V familjen i framkant (även på bilden).
Resized_20180107_155537.jpeg
Tack för hjälpen med tipsen

/Stefan
Du har inte behörighet att öppna de filer som bifogats till detta inlägg.
Skriv svar