Differences

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

Link to this comparison view

Next revision
Previous revision
en:examples:display:lcd [2015/03/26 14:27] – created heikopikneren:examples:display:lcd [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
-~~PB~~ +<pagebreak> 
-====== Ekraan ======+====== LCD screen ======
  
-//Vajalikud teadmised:  +//Necessary knowledge:  
-[HW] [[et:hardware:homelab:digi]],  +[HW] [[en:hardware:homelab:digi]],  
-[LIB] [[et:software:homelab:library:module:lcd_alphanumeric]], [LIB] [[et:software:homelab:library:module:lcd_graphic]], \\ +[LIB] [[en:software:homelab:library:module:lcd_alphanumeric]], [LIB] [[en:software:homelab:library:module:lcd_graphic]], \\ 
-[LIB] [[et:software:homelab:library:delay]]//+[LIB] [[en:software:homelab:library:delay]]//
  
-===== Teooria =====+===== Theory =====
  
-[{{ :examples:display:lcd:lcd_element.jpg?250|Graafilise LCD element}}]+[{{ :examples:display:lcd:lcd_element.jpg?250|The graphical LCD element}}]
 /*[{{  :examples:display:lcd_alphanumeric:lcd_alphanumeric_abc.png?200|Alfabeetilise LCD pikslite maatriksitest moodustatud tekst}}]*/ /*[{{  :examples:display:lcd_alphanumeric:lcd_alphanumeric_abc.png?200|Alfabeetilise LCD pikslite maatriksitest moodustatud tekst}}]*/
  
-[{{  :examples:display:lcd_graphic:lcd_graphic_smiley.png?200|Graafilise LCD pikslitest moodustatud pilt}}]+[{{  :examples:display:lcd_graphic:lcd_graphic_smiley.png?200|The picture formed of pixels of a graphic LCD}}]
  
-Mikrokontrolleritega kasutatavad LCD ekraanid võib jaotada üldistatult kaheksteksti LCD ehk alfabeetiline LCD ja graafiline LCD. 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 tumedana.+LCD screens, which are used with microcontrollers, can be divided mainly into a two partsa text or alphanumeric LCD and a graphic LCD. Alphanumeric LCD is liquid crystal display, with the purpose of displaying letters and numbersIn 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äikeste 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 examplea matrix of 5×7 pixels is enough to display all numbers, and 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.
  
-Alfabeetiline LCD ekraan koosneb peale ekraani enda veel ka kontrollerist, mis vastavalt sideliidesest tulevatele käskudele juhib ekraani segmenteKontrollerisse on eelnevalt sisse programmeeritud tähekaartkus igal tähelnumbril või märgil on oma järjekorranumber ehk indeksEkraanil teksti kuvamine toimub põhimõtteliselt LCD kontrollerile tähtede indekseid saates. Tegelikkuses tuleb LCD kontrolleritele ka mitmeid juhtkäske saata, enne kui midagi kuvama hakatakse. Iga konkreetse LCD ekraani kasutamiseks tuleb tutvuda enne selle andmelehega, kuna neid on väga erinevaid ning ühtlasi ka nende juhtimine toimub erinevalt +Besides the screen Alphanumerical LCD has also controller which controls the segments of the screen according to the commands from the communication interfaceA controller has a preprogrammed card of letterswhere each letternumber 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.
-/*Alfabeetilised LCD ekraanid on üldjuhul passiivmaatriksiga, kus segmentide elektrivälja uuendamine toimub kordamööda. Sellest tulenevalt on passiivmaatriksiga ekraanid aeglasemad ja kehvema kontrastiga kui aktiivmaatriks-ekraanid, kus iga segmendi laengut juhib eraldi transistor. LCD ekraane on nii peegelduva taustaga kui taustvalgustusega, vahel isegi mitme erinevat värvi taustvalgustusega. Segmendi värve on alfabeetlistel LCD ekraanidel enamasti siiski üks reeglina mustkuid esineb ka valge ja värvilise kirjaga ekraane. +
-*/+
  
-Graafiline LCD on vedelkristall-ekraan, millega saab peale teksti ka kujundeid kuvadaSelle ehitus sarnaneb alfabeetilisele LCD-le ja põhiline erinevus seisneb selleset graafilisel ekraanil on kõik pikslid jaotatud üle ekraani ühe suure maatriksinaKui tegu on monokromaatilise graafilise LCD ekraanigasiis piksel on üks pisike ruudukujuline segment. Värvilistel ekraanidel moodustab üks piksel kolmest alampikslistmillest igaüks laseb läbi värvifiltri kas punast, rohelist või sinist valgustKuna alampikslid on lähestikkupaistavad need kui üks piksel.+Graphical LCD liquid crystal display is a display which allows displaying pictures and textIts construction is similar to the alphanumerical LCD, with a difference that on the graphic display all pixels are divided as one large matrixIf we are dealing with a monochrome LCD, then a pixel is one square segment. Color displays’ one pixel is formed of three subpixels. Each of the three subpixels lets only one colored light pass (redgreen or blue)Since the subpixels are positioned very close to each otherthey seem like one pixel.
  
-Monokromaatilised graafilised ekraanid on tavaliselt passiivmaatriksigasuured värvilised ekraanid, kaasa arvatud arvutiekraanid, on aktiivmaatriksigaKogu tausta- ja pikslite värvi puudutav info on graafilistel LCD-del sarnane alfabeetiliste LCD omadustega ja sarnaselt alfabeetiliste ekraanidega on ka graafilistel ekraanidel eraldi kontrollermis hoolitseb sideliidese kaudu info vastuvõtmise ja segmentide elektrivälja tekitamise eest+Monochrome graphic displays have usually passive matrixlarge color displays including computer screens have active matrixAll information concerning the color of the background and the pixels of the graphic LCDs are similar to alphanumerical LCDs. Similar to the alphanumerical displays, graphic displays are also equipped with separate controllerwhich takes care of receiving information through the communication interface and generates the electrical field for the segments.
  
-===== Praktika ===== 
  
-Kodulabori III seeria Kasutajaliidese moodulile on paigaldatud 128 x 160 piksliga 1,8 tolline täisvärviline TFT LCD ekraan. Ekraani juhib Sitronixi ST7735 LCD kontroller, mida juhtakse üle SPI siini. Lisaks on juhitav ekraani taustavalgus, kuid ilma taustavalguseta ei ole võimalik ekraani kasutada. Ekraaniga suhtlemine pole kuigi keeruline, kuid funktsioonide suure arvu tõttu pole siinkohal seda lahti seletatud. Kodulabori teegis on olemas funktsioonid selle kasutamiseks.+===== Practice =====
  
-Erinevalt Kodulabor III-st on Kodulabor II varustatud monokromaatilise graafilise 84 x 48 piksli LCD ekraanigamis on tundud ka vanemate Nokia mobiiltelefonide pealtEkraani küljes on Philipsi PCD8544 kontrollermillega saab suhelda läbi SPI-taolise järjestikliideseEraldi juhitav on veel ekraanimooduli taustvalgustus+In the HomeLab III set is a 128×160 pixels and 1,8 inch full color TFT LCD screen. Sitronixi ST7735 controller is attached to the display which can be communicated through SPI serial interface. The background lighting of the display module is separately controlledbut without the background light, it is not possible to use the screenCommunicating with the display is not very difficultbut due to the large amount of the functions it is not explained hereHome-Labs library has functions for using it.
  
-Graafilise LCD kasutamiseks tuleb esmalt ekraan algväärtustada funktsiooniga //lcd_gfx_init//Teeki on sisse kirjutatud tähekaart kogu ladina tähestikunumbrite ja üldkasutatavate märkidegaTähe või teksti kuvamiseks tuleb eelnevalt //lcd_gfx_goto_char_xy// funktsiooniga määrata selle asukohtTähe kuvamiseks on //lcd_gfx_write_char// ja teksti kuvamiseks //lcd_gfx_write_string// funktsioonMuid funktsioone näeb juba teegi dokumentatsioonistJärgnevalt on toodud näide aja loenduri kohta. Programm loendab sekundeid (ligikaudu), minuteid ja tundeAja tekstiks teisendamiseks on kasutusel //sprintf// funktsioon.+Main difference compared to from HomeLab III to HomeLab II is a 84×48 pixels monochrome graphic LCD. It is the same display as used in Nokia 3310 mobile phones. Philips PCD8544 controller is attached to the display which can be communicated through SPI-like serial interface. The background lighting of the display module is separately controlled.  
 + 
 +First, the graphical LCD screen must be started with //lcd_gfx_init// functionThere is a letter map in side of the library with full Latin alphabetnumbers and with most common signs writtenTo display a letter or text, first its position must be determined by using function //lcd_gfx_goto_char_xy//For displaying s letter is //lcd_gfx_write_char// function and for displaying text //lcd_gfx_write_string// function. 
 + 
 +The following is an example of time counterThe program counts seconds (approximately), minutes and hoursFor converting time to text sprintf function is used.
  
 <code c> <code c>
-// Kodulabori graafilise LCD kasutamise näide+// Example of using the graphic LCD of the HomeLab 
 +// Time of day is displayed on LCD since the beginning of the program
 #include <stdio.h> #include <stdio.h>
 #include <homelab/module/lcd_gfx.h> #include <homelab/module/lcd_gfx.h>
 #include <homelab/delay.h> #include <homelab/delay.h>
  
-// Põhiprogramm+// Main program
 int main(void) int main(void)
 { {
-  int seconds = 0; + int seconds = 0; 
-  char text[16];+ char text[16];
  
-  // LCD ekraani algseadistamine + // Set-up of the LCD 
-  lcd_gfx_init(); + lcd_gfx_init();
-  // Ekraani puhastamine +
-  lcd_gfx_clear(); +
-  // Taustavalgustuse tööle lülitamine +
-  lcd_gfx_backlight(true);  +
-  // Programmi nime kuvamine +
-  lcd_gfx_goto_char_xy(1, 1); +
-  lcd_gfx_write_string("Aja loendur");+
  
-  // Lõputu tsükkel  + // Cleaning the screen 
-  while (1)  { + lcd_gfx_clear();
-   // Sekundite teisendamine kellaaja kujule hh:mm:ss +
-   sprintf(text, "%02d:%02d:%02d",  +
-               (seconds / 3600) % 24, (seconds / 60) % 60, seconds % 60);+
  
-   // Kellaaja teksti kuvamine + // Switching on the background light 
-   lcd_gfx_goto_char_xy(3, 3); + lcd_gfx_backlight(true);  
-   lcd_gfx_write_string(text);+ 
 + // Displaying the name of the program 
 + lcd_gfx_goto_char_xy(1, 1); 
 + lcd_gfx_write_string("Time counter"); 
 + 
 + // Endless loop  
 + while (true) 
 +
 + // Converting the seconds to the form of clock 
 + // hh:mm:ss 
 + sprintf(text, "%02d:%02d:%02d", 
 + (seconds / 3600) % 24, 
 + (seconds / 60) % 60, 
 + seconds % 60); 
 + 
 + // Displaying the clock text 
 + lcd_gfx_goto_char_xy(3, 3); 
 + lcd_gfx_write_string(text)
 +  
 + // Adding one second 
 + seconds++;
   
-   // Sekundi suurendamine 1 võrra + // Hardware delay for 1000 ms 
-   seconds++; + hw_delay_ms(1000); 
-   // Riistvaraline paus 1000 millisekundit + }
-   hw_delay_ms(1000); +
-   }+
 } }
 </code> </code>
en/examples/display/lcd.1427380038.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