How Blue Bridge Cup competition embedded LCD screen, highlight a character

Disclaimer: This article is a blogger original article, if reproduced, please indicate the source https://blog.csdn.net/qq_36554582/article/details/88384537

Blue Bridge Cup embedded ninth tournament title used in the highlights, mainly by
void LCD_DisplayChar(u8 Line, u16 Column, u8 Ascii);to complete the function that is suddenly no longer operate the line, but all of a sudden just to manipulate a character, ASCII code parameter is passed , three parameters were inlet: ASCII code row, column, data.
Look at the specific operation:
1, direct display of a character:

LCD_SetTextColor(Red);
LCD_DisplayChar(Line4, 319-176, 'A');

The first parameter is the fourth row, the second parameter is the number of columns, a total of 319 since the LCD, if the column is set to 0, then it is displayed from the right, looking for the convenience, I use the 319-176, It indicates that I want the red "a" in the display section 176 of the left.
2, the display in a variable:

dat1 = THH / 10;
dat2 = THH % 10;
LCD_SetTextColor(Red);
LCD_DisplayChar(Line4, 319-97, dat1+'0');
LCD_DisplayChar(Line4, 319-113, dat2+'0');
LCD_DisplayChar(Line4, 319-128, ':');

Because the LCD_DisplayChar()function can only manipulate a character, so if you want to highlight is greater than or equal to 2 digits of the time, we need to be a bit isolated, ten, etc., and then separately for every show, Although some trouble, but did so only temporarily.
Since the LCD_DisplayChar()function parameter is passed in the form of ASCII code, so the display variable, also need to ASCII code conversion, either plus 0x30or directly coupled '0'.

Guess you like

Origin blog.csdn.net/qq_36554582/article/details/88384537