Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:examples:display:lcd_alphanumeric [2010/02/08 12:50] mikk.leinien:examples:display:lcd_alphanumeric [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Alphanumeric LCD ====== ====== Alphanumeric LCD ======
  
-//Vajalikud teadmised[HW] [[en:hardware:homelab:lcd]], [LIB] [[en:software:homelab:library:module:lcd_alphanumeric]], [LIB] [[en:software:homelab:library:delay]], [PRT] [[en:examples:timer:periodic_interrupt]]//+//Necessary knowledge: [LIB] [[en:software:homelab:library:module:lcd_alphanumeric]], [LIB] [[en:software:homelab:library:delay]], [PRT] [[en:examples:timer:periodic_interrupt]]//
  
-===== Teooria =====+===== Theory =====
  
-Alfabeetiline LCD on vedelkristall-ekraan (inglise keeles //liquid crystal display//)mis on ette nähtud tähtede ja numbrite kuvamiseksInglise keeles nimetatakse seda kui //alphanumeric// LCD. Lihtsamates vedelkristall-ekraanides kasutatakse läbipaisvate elektroodide vahele paigutatud vedelat kristallimis muudab elektriväljas läbiva valguse polarisatsiooniElektroode katavad veel polarisatsioonifiltridmis tagavad, et kogu ekraani saab läbida vaid ühtpidi polariseeritud valgusKui vedelkristall elektrivälja mõjul polarisatsiooni muudabsiis valgus ekraani või selle osa (segmentiläbida ei saa ning see paistab tume.+Alphanumeric LCD is liquid crystal display, with the purpose of displaying letters and numbers In basic LCD is used liquid crystal which is placed between transparent electrodesand which changes the polarization of the passing light in electrical fieldThe electrodes are covered by polarization filterswhich assure that only one way polarized light can pass the screenIf the liquid crystal changes its polarity due to an electrical fieldthe light can not pass the screen or part (segmentof it and it looks dark
  
-Põhiline iseloomustaja on alfabeetilise LCD juures tema segmentide paigutusEkraan on jagatud paljudeks indikaatoriteksIgal indikaatoril on kas piisavalt palju segmente tähtede ja numbrite kuvamiseks või moodustub see väikesest ruudukujuliste segmentide (pikslitemaatriksistNäiteks 5x7 pikslisest maatriksist piisab kõigi numbriteladina tähestiku ja täppidega tähtede kuvamiseksIndikaatoreid on tavaliselt 1-rida ja 8-32 tulpaIgal indikaatoril on väike vahe sees, täpselt nagu tekstis tähtedelgi.+Main characteristic of alphanumerical LCD is the placing of its segmentsThe screen is divided into many indicatorsEach indicator has either enough segments for displaying letters and numbers or it is formed from matrix of little square segments (pixels). For example, a matrix of 5x7 pixels is enough to display all numbersand letters of Latin alphabetThere are usually – rows of indicators and – 32 columnsEach indicator has a small difference similar to the differences of the letters in text.
  
-[{{  :examples:display:lcd_alphanumeric:lcd_alphanumeric_abc.png?200|Alfabeetilise LCD pikslite maatriksitest moodustatud tekst}}] 
  
-Alfabeetiline LCD ekraan koosneb peale ekraani enda veel ka kontrollerist, mis vastavalt sideliidesest tulevatele käskudele juhib ekraani segmente. Kontrollerisse on eelnevalt sisse programmeeritud tähekaart, kus igal tähel, numbril või märgil on oma järjekorranumber ehk indeks. Ekraanil teksti kuvamine toimub põhimõtteliselt kontrollerile tähtede indekseid saates. Tegelikkuses tuleb LCD kontrolleritele ka mitmeid juhtkäske saata, enne kui midagi kuvama saab hakata. LCD ekraanide kasutamiseks tuleb tutvuda nende andmelehega, sest neid on väga erinevaid.+[{{  :examples:display:lcd_alphanumeric:lcd_alphanumeric_abc.png?200|The text formed of alphanumerical LCD pixels' matrixes.}}]
  
-Alfabeetilised LCD ekraanid on üldjuhul passiivmaatriksigakus segmentide elektrivälja uuendamine toimub kordamöödaSellest tulenevalt on passiivmaatriksiga ekraanid aeglasemad ja kehvema kontrastiga kui aktiivmaatriks-ekraanid kus iga segmendi laengut juhib eraldi transistorLCD ekraane on nii peegelduva taustaga kui taustvalgustusega, vahel isegi mitme erinevat värvi taustvalgustusegaSegmendi värve on alfabeetlistel LCD ekraanidel enamasti siiski üks enamasti mustkuid esineb ka valge ja värvilise kirjaga ekraane.+Besides the screen Alphanumerical LCD has also controller which controls the segments of the screen according to the commands from the communication interface.  A controller has a preprogrammed card of letterswhere each letter, number or symbol has its own indexDisplaying the text on the screen is basically done by sending the indexes to the controllerIn reality there must be more control orders sent to the controller before anything can be displayedIt is important to get familiarize with each LCD data-sheetbecause there are many different types of LCDs and they all are controlled differently.
  
-===== Praktika =====+Alphanumerical LCDs are usually with passive matrix, where renewal of the electrical field of the segments is tone in turns. That is why the screens with passive matrix are slower and have less contrast compared with the active matrix screens where the charge of each segment is controlled by separate transistor. Some LCDs are with reflective back and others with backlight sometimes even with several different backlights. But segment colour for alphanumerical LCDs is usually still one – which is black, however there are also screens with white and colorful writings.      
  
-Kodulabori digitaalse mooduli külge ühendub 2x16 märgine alfabeetiline LCD WC1602A. Ekraani juhtimiseks on 4-bitine andmesiin ja 3 juhtviiku, kuid selle suhtlusprotokoll on liiga mahukas, et siinkohal lahti seletada. Lihtsuse huvides on ekraani kasutamiseks kodulabori teegis olemas vastavad funktsioonid. 
  
-Esimene asimis ekraani kasutamiseks teha tulebon see seadistadaVastavaks otstarbeks on //lcd_alpha_init//-funktsioonmillega saab määrata ekraanile ka vilkuva kursori. Ekraanil on olenemata sellestkas seda on näha või mittepidevalt üks aktiivne kursori positsioonkuhu järgmine täht sisestatakseSeega tuleb enne teksti sisestamist viia kursor soovitud asukohaleKursori asukoha muutmiseks on //lcd_alpha_goto_xy/ja teksti kuvamiseks //lcd_alpha_write_string//-funktsioon. Kõik alfabeetilise LCD funktsioonid on lahti seletatud selle teegis.+===== Practice ===== 
 + 
 +HomeLabs Digital i/o module connects a 2x16 symbol alphanumerical LCD WC 1602A. For controlling the screenthere is a 4-bit data-bus and 3 control pinsbut its communication protocol is too capacious, to be explained hereFor simplicity, the library of the HomeLab has corresponding functions for using the display.  
 + 
 +Before using the display it is vital to adjust its settings. For this purpose is the // lcd_alpha_init// functionwhich sets a blinking cursor on the screen. On screen is always only one active position for the cursor where next letter is enteredregardless whether it can be seen or not. So before entering the textthe cursor must be taken to the desired place. For changing the position of the cursor is a function lcd_alpha_goto_xy and for displaying it lcd_alpha_write_string. All the functions of the alphanumerical LCD are explained in its library. 
 + 
 +The following program code demonstrates the usage of alphanumerical LCD as a clock. The Time begins at 00:00:00 and grows approximately in every second. Since the counting of the time is done with the delay functionit is not very preciseThe inaccuracy is explained in the exercise of the periodic interruptionThe program counts the seconds and converts them into minutes and seconds. For using clock time is a standard function in the C-language: //sprintf//.     
  
-Järgnev programmikood demonstreerib alfabeetilise LCD kasutamist kellana. Kellaaeg algab alates 00:00:00 ja suureneb iga sekundiga (ligikaudu). Kuna aja lugemine toimub viite funktsiooniga, siis pole see päris täpne. Ebatäpsust selgitab perioodilise katkestuse harjutus. Programm loeb sekundeid ja teisendab need arvutuste abil minutiteks ja sekunditeks. Kellaaja kujule viimiseks on kasutusel C-keele standardfunktsioon //sprintf//. 
  
 <code c> <code c>
 // //
-// Kodulabori alfabeetilise LCD kasutamise näide+// The example of using the alphanumerical LCD of the HomeLab
-// LCD-le kuvatakse kellaaeg programmi algusest alates.+// The clock time starting at the beginning of the program is displayed on the LCD.
 // //
 #include <stdio.h> #include <stdio.h>
Line 33: Line 36:
  
 // //
-// Põhiprogramm+// Main program.
 // //
 int main(void) int main(void)
Line 40: Line 43:
  char text[16];  char text[16];
  
- // LCD ekraani seadistamine+ // Set-up of the LCD.
  lcd_alpha_init(LCD_ALPHA_DISP_ON);  lcd_alpha_init(LCD_ALPHA_DISP_ON);
  
- // LCD ekraani puhastamine+ // Cleaning of the LCD.
  lcd_alpha_clear();  lcd_alpha_clear();
  
- // Programmi nimi + // Name of the program. 
- lcd_alpha_write_string("Aja loendur");+ lcd_alpha_write_string("The Time Counter");
  
- // Lõputu tsükkel + // Endless loop
  while (true)  while (true)
  {  {
- // Sekundite teisendamine kellaaja kujule+ // Converting the seconds to the clock form:
  // hh:mm:ss  // hh:mm:ss
  sprintf(text, "%02d:%02d:%02d",  sprintf(text, "%02d:%02d:%02d",
Line 59: Line 62:
  seconds % 60);  seconds % 60);
  
- // Kellaaja teksti kuvamine LCD teise rea alguses+ // Displaying the clock text in the LCD.
  lcd_alpha_goto_xy(0, 1);  lcd_alpha_goto_xy(0, 1);
  lcd_alpha_write_string(text);  lcd_alpha_write_string(text);
   
- // Sekundi suurendamine võrra+ // Growing seconds by 1.
  seconds++;  seconds++;
   
- // Riistvaraline paus 1000 millisekundit+ // Hardware delay 1000 ms.
  hw_delay_ms(1000);  hw_delay_ms(1000);
  }  }
 } }
 </code> </code>
en/examples/display/lcd_alphanumeric.1265633416.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0