This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:examples:display:lcd [2015/11/05 11:43] – heikopikner | en:examples:display:lcd [2020/07/20 09:00] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ~~PB~~ | + | < |
====== LCD screen ====== | ====== LCD screen ====== | ||
Line 36: | Line 36: | ||
<code c> | <code c> | ||
- | // Example of using the graphic LCD of the HomeLab. | + | // Example of using the graphic LCD of the HomeLab |
- | // Time of day is displayed on LCD since the beginning of the program. | + | // Time of day is displayed on LCD since the beginning of the program |
#include < | #include < | ||
#include < | #include < | ||
#include < | #include < | ||
- | // Main program. | + | // Main program |
int main(void) | int main(void) | ||
{ | { | ||
Line 48: | Line 48: | ||
char text[16]; | char text[16]; | ||
- | // Set-up of the LCD. | + | // Set-up of the LCD |
lcd_gfx_init(); | lcd_gfx_init(); | ||
- | // Cleaning the screen. | + | // Cleaning the screen |
lcd_gfx_clear(); | lcd_gfx_clear(); | ||
- | // Switching on the background light. | + | // Switching on the background light |
lcd_gfx_backlight(true); | lcd_gfx_backlight(true); | ||
- | // Displaying the name of the program. | + | // Displaying the name of the program |
lcd_gfx_goto_char_xy(1, | lcd_gfx_goto_char_xy(1, | ||
lcd_gfx_write_string(" | lcd_gfx_write_string(" | ||
- | // Endless loop. | + | // Endless loop |
while (true) | while (true) | ||
{ | { | ||
- | // Converting the seconds to the form of clock. | + | // Converting the seconds to the form of clock |
// hh:mm:ss | // hh:mm:ss | ||
sprintf(text, | sprintf(text, | ||
Line 71: | Line 71: | ||
seconds % 60); | seconds % 60); | ||
- | // Displaying the clock text. | + | // Displaying the clock text |
lcd_gfx_goto_char_xy(3, | lcd_gfx_goto_char_xy(3, | ||
lcd_gfx_write_string(text); | lcd_gfx_write_string(text); | ||
- | // Adding one second. | + | // Adding one second |
seconds++; | seconds++; | ||
- | // Hardware delay for 1000 ms. | + | // Hardware delay for 1000 ms |
hw_delay_ms(1000); | hw_delay_ms(1000); | ||
} | } | ||
} | } | ||
</ | </ |