Characters that Raspberry Pi LCD can Show


At the article Add LCD Panel to Raspberry Pi, I installed Adafruit Raspberry Pi LCD Kit to Raspberry Pi. Here, I wrote about the character which the LCD panel can show.

How to Display Characters

You can display characters on the lcd panel with Adafruit_Python_CharLCD, like lcd.message(text). If you want to display one specific character, write lcd.message(chr(n)), n is character number. n should be equal to or greater than 0 and equal to or less than 255. If you input number larger than 255 to n, the number is recognized as remainder after divided by 256. And, all number from 0 to 255 is not represent human readable character.

Available Human Readable Characters

We can see them om datasheet in Adafruit site.

一覧にすると以下のようになります。 HTML で簡単に表現できないものは言葉で表現しています。

2 3 4 5 6 7
0 (space) 0 @ P ` p
1 ! 1 A Q a q
2 2 B R b r
3 # 3 C S c s
4 $ 4 D T d t
5 % 5 E U e u
6 & 6 F V f v
7 7 G W g w
8 ( 8 H X h x
9 ) 9 I Y i y
A * : J Z j z
B + ; K [ k {
C , < L ¥ l |
D = M ] m }
E . > N ^ n
F / ? O _ o
A B C D E F
0 α larger p
1 ä smaller q
2 β θ
3 ε
4 μ Ω
5 σ ü
6 ρ Σ
7 larger g π
8 x bar
9 -1 (index number) larger y
A larger j
B left upper small x
C ¢
D £ (L and 2 horizontal bars) ÷
E n bar
F ソ ö (square)

Yes, the LCD supports Japanese character, too.

この表は、行番号と列番号を16進数に見立てて使います。 If you want to show “2”, which is located at row 2 column 3, write lcd.message(chr(0x32)). You can also write like lcd.message('x32'). In the datasheet, it is explained with binary number, so on showing “2”, whose Lower 4 bit is “0010” and Upper 4 bit is “0011”, write like lcd.message(chr(int('00110010', 2))).

Display Whatever You Want

Adafruit_Python_CharLCD で用意された lcd.create_char を使います。

The method’s first parameter is for character number (0-255), the second is for the array of dots pattern.

How to Express Dots Pattern点灯ドットの表現方法

One character is composed of 40 dots, 5 dots per line.

Pass array of numbers that represents one line dot pattern to the second parameter. The array contains 8 numbers.

How to Represent One Line

One line is composed of 5 dots. Array each dot’s on and off as number 1 and 0, from left to right.

For example, only left-most dots is on, the expression is 10000. Take it as binary number, then 16 is the line expression number.

For example, all dots is on then the second parameter is [16, 16, 16, 16, 16, 16, 16, 16].

Example

Sample code in Adafruit repository contains the following line. It defines a custom character. And on displaying, follow the next line.

You can check character definition with the program below.

LCD Character Value