📄 grlcddemo.c
字号:
#include <stdio.h>
#include "GrLCD.h"
String_T str1 = { 1, C50J+FONT16, 0, "Hello World" }; // large chars on pages 1 & 2
String_T str2 = { 4, L33J, 0, "Time" }; // small chars on page 4
String_T str3 = { 4, R66J, 0, "Temperature" };
String_T str4;
String_T str5 = { 7, ABSJ, 70, "That's all, folks" }; // small chars on page 7 at column 70
String_T *list1[5] = { CLEAR, &str1, &str2, &str3, EOL }; // list of strings to display, in this
// example the CLEAR code is redundant
// since the display was just initialized
char buffer[128];
void main(void)
{
GrLCDInit(); // initialize the display
GrLCDList(list1); // show first 3 strings
str4.page = 5; // make a dynamic string definition
str4.cj_code = L33J+FONT16; // large chars, centered @ 1/3
str4.text = buffer; // point to text buffer
sprintf(buffer, "%2.2d:%2.2d:%2.2d", 11, 22, 33); // build a time string in buffer
GrLCDText(&str4); // display the time
str4.cj_code = R66J+FONT16; // new justify location, page & text pointer remain same
sprintf(buffer, "%d F", 68);// build a temperature string in buffer
GrLCDText(&str4); // display the temperature
// make a string of text blinking by alternating showing it and erasing it, leaving other text
// unchanged. Each time the GrLCDText() function is called, the startcol and column vars are
// left set to the starting and ending columns of the displayed text, allowing a specific
// area to be erased. To blink more than one string, save the starting and ending points of
// each one after the calls to GrLCDText().
for (;;) // infinite loop
{
invertflg = 0xFF; // make this text inverted (white on black)
GrLCDText(&str5); // show text
Sleep(500); // for a while
GrLCDBlank(str5.page, startcol, // erase the text just shown,
column - startcol, // the invert flag is cleared
str5.cj_code & FONT16);
Sleep(500); // wait a while
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -