Instrukcja obsługi Joy-It RB-LCD-16x2
Przeczytaj poniżej 📖 instrukcję obsługi w języku polskim dla Joy-It RB-LCD-16x2 (15 stron) w kategorii Zabawki. Ta instrukcja była pomocna dla 2 osób i została oceniona przez 2 użytkowników na średnio 4.5 gwiazdek
Strona 1/15
Beginner’s Guide
to the
PI LCD
Part 4: Graphics
, W8BH
1) INTRODUCTION
In the rst three parts of this series, we learned how to display text and simple graphics on
the LCD board (available from mypishop.com). It’s time to kick it up a notch, and create a
suite of useful graphics functions. We’ll even create a large-digit clock. You may have
purchased either a 16x2 or a 20x4 display with your kit. In this write-up I’ll be using the
20x4 display. When it comes to graphics, bigger is better!
2) SIMPLE HORIZONTAL BAR GRAPHS
An important requirement for creating detailed graphics is that the display device is dot-
addressable. In other words, each display pixel can be individually addressed and
programmed, separate from its neighbors. Sadly, our HD44780 controller does not give us
a dot-addressable LCD display. We get only pre-determined characters, plus 8 characters
of our own design. How can we possibly do artwork on that?
Well, we can’t. Go ahead, prove me wrong. Detailed graphics with this LCD module are
devilishly hard to do. But that doesn’t mean we can’t create useful, simpler graphics. Bar
graphs, for example.
First, consider a single, horizontal
bar graph. Here is our 20x4
display, with a horizontal bar that is
12 characters wide. If we need to
display data that over a small
integer range, like 0-15, we can do it by repeating the solid block (0xFF) character for the
desired length. You might code it like this:
def HorizBar(row,startCol,length):
GotoXY(row,startCol) #go to starting position
for count in range(length):
SendByte(0xFF,True) #display bar of desired length
This simple code works, and is surprisingly useful. You aren’t limited to small ranges: just
scale the desired range to 0-15 by the appropriate conversion factor. But your graph will
always look a little coarse and chunky, since there are a limited number of possible data
values/lengths.
3 BETTER HORIZONTAL BAR GRAPHS)
The graph will look better if we improve the horizontal resolution. But how? We can get a
ve-fold improvement in resolution if we use the simple graphics from Part 3.
Consider the individual character. It contains 40 individual pixel “dots”,
arranged in an 8 row, 5 column grid. We can’t access each individual
pixel, but we can create custom symbols like this vertical bar. Display this
one to the right of the 12-character bar above, and you’ve just made a bar
of length 12.2!
Let’s make a set of vertical bar symbols, progressively increasing the
number of columns in the symbol
0.2 0.4 0.6 0.8 1.0
Now we can increment the length of our horizontal bar in fractions of a character, improving
the horizontal resolution of our graph. ime to code it. First, create the set of symbols, It’s t
like we did in part 3:
horizontalBars = [
[ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 ], #1 bar
[ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 ], #2 bars
[ 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C ], #3 bars
[ 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E ], #4 bars
[ 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F ] #5 bars
]
Now we need a routine to draw the horizontal bar for a given length. To simplify things, let’s
stay with integer lengths, and give each vertical bar a length of one (instead of 0.2). In this
system our original 12 character bar is 12*5 = 60 units long. Any length can be represented
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
by a combination of ‘full characters’ which contain 5 bars each, followed by a terminal
character containing less than 5 bars. For example, a bar graph of length 27 will be 5 full
characters (5*5=25), followed by a character containing the last 2 bars:
Bar of 27 units =
5 Filled Characters +
1 Partially Filled
Character
We can calculate the number of full characters by integer division: length/5. And the
number of bars in the nal, partially lled character is just the remainder: length % 5. A
function for writing the horizontal bar sends the required number of solid -lled characters, ly
then a single, partially-lled character. Assume that the symbols have previously been
loaded into the character-generator RAM at positions 0 through 4.
def DrawHBar(row,length):
fullChars = length / 5
bars = length % 5
GotoXY(row,0) #start at beginning of row
for count in range(fullChars): #full characters sent first
SendByte(4,True)
if bars>0: #final, partially filled character
SendByte(bars-1,True)
The call to SendByte(4,True) sends the fourth symbol in CG-RAM, which is the 5-bar (lled)
character.
4 ANIMATED HORIZONTAL BAR GRAPHS )
The graphs are nice, and fun to watch a few times. But looking at fat lines gets dull after a
while. Let’s spice them up a bit, and add some animation like we did in part 3 with the
‘battery charging’ symbol.
To animate the graph, we need two key functions: one to increment the graph length, and
one to decrement it. Then animation becomes the simple task of keeping track of how
many increments/decrements to do. Using a top-down approach, lets write this function
rst, and worry about the increment/decrement later.
def AnimatedHBar(row,startCol,newLength,oldLength=0):
diff = newLength - oldLength
for count in range(abs(diff)):
if diff>0:
IncrementHBar(row,startCol,oldLength)
oldLength +=1
else:
DecrementHBar(row,startCol,oldLength)
oldLength -=1
Specyfikacje produktu
Marka: | Joy-It |
Kategoria: | Zabawki |
Model: | RB-LCD-16x2 |
Potrzebujesz pomocy?
Jeśli potrzebujesz pomocy z Joy-It RB-LCD-16x2, zadaj pytanie poniżej, a inni użytkownicy Ci odpowiedzą
Instrukcje Zabawki Joy-It
21 Września 2024
21 Września 2024
21 Września 2024
20 Września 2024
Instrukcje Zabawki
- Zabawki Ikea
- Zabawki Kindercraft
- Zabawki Lego
- Zabawki Berg
- Zabawki Hasbro
- Zabawki DJI
- Zabawki Chicco
- Zabawki Spin Master
- Zabawki Biltema
- Zabawki Playmobil
- Zabawki Crivit
- Zabawki Salta
- Zabawki Little Tikes
- Zabawki Chipolino
- Zabawki Velleman
- Zabawki DS
- Zabawki Hauck
- Zabawki Vtech
- Zabawki Lenoxx
- Zabawki Peg Perego
- Zabawki Parrot
- Zabawki Makeblock
- Zabawki Carrera
- Zabawki Viper
- Zabawki Kinderkraft
- Zabawki Smoby
- Zabawki Mattel
- Zabawki Jumbo
- Zabawki Kemo
- Zabawki Playtive
- Zabawki Ravensburger
- Zabawki SereneLife
- Zabawki EasyMaxx
- Zabawki BABY Born
- Zabawki Lorelli
- Zabawki Arctic
- Zabawki MJX
- Zabawki BeeWi
- Zabawki Huffy
- Zabawki Easypix
- Zabawki Sunny
- Zabawki Steren
- Zabawki King
- Zabawki Fisher Price
- Zabawki Kayoba
- Zabawki Tamiya
- Zabawki Amigo
- Zabawki X4-Tech
- Zabawki Ingo
- Zabawki Plum
- Zabawki Feber
- Zabawki Syma
- Zabawki Megableu
- Zabawki Valk
- Zabawki Wilesco
- Zabawki FABER CASTELL
- Zabawki Crayola
- Zabawki Marklin
- Zabawki Mega Bloks
- Zabawki WowWee
- Zabawki Ninetec
- Zabawki Nerf
- Zabawki KidKraft
- Zabawki Geomag
- Zabawki Yuneec
- Zabawki Bellelli
- Zabawki AXI
- Zabawki Thames & Kosmos
- Zabawki Knex
- Zabawki MNKY
- Zabawki Laptronics
- Zabawki Falk
- Zabawki Silvergear
- Zabawki Kids Knex
- Zabawki Rayline
- Zabawki Quadro
- Zabawki Pardini
- Zabawki Tiamo
- Zabawki Svexia
- Zabawki Skippy Buddy
- Zabawki Fast Rider
- Zabawki Plusbricks
- Zabawki Kogan
- Zabawki Backyard Discovery
- Zabawki Rovo Kids
- Zabawki Snap Circuits
- Zabawki Rainbow
- Zabawki Gagato
- Zabawki BIG
- Zabawki Discovery
- Zabawki Dynacraft
- Zabawki Cosco
- Zabawki Step2
- Zabawki Jamara
- Zabawki Zizzle
- Zabawki Starlyf
- Zabawki Vandermeulen
- Zabawki Merlin
- Zabawki Pure Fun
- Zabawki Dickie
- Zabawki Lidl
- Zabawki Playland
- Zabawki Hurtle
- Zabawki Jobe
- Zabawki WLtoys
- Zabawki Style Me Up
- Zabawki Bruder
- Zabawki Hudora
- Zabawki Rolly Toys
- Zabawki ProSin
- Zabawki SpinMaster
- Zabawki Tot Tutors
- Zabawki Dario
- Zabawki Invento
- Zabawki Estes
- Zabawki Air Wars
- Zabawki Radio Flyer
- Zabawki Pedalo
- Zabawki Millennium
- Zabawki Webley
- Zabawki Polly Pocket
- Zabawki AquaPlay
- Zabawki Teksta
- Zabawki Trigano-Jardin
- Zabawki Promedia
- Zabawki Triumph Sports
- Zabawki Bullet
- Zabawki Schleich
- Zabawki Propel
- Zabawki Elenco
- Zabawki Gel Blaster
- Zabawki Nils Fun
- Zabawki Nordic Play
- Zabawki Swurfer
- Zabawki Valley Dynamo
Najnowsze instrukcje dla Zabawki
13 Października 2024
13 Października 2024
11 Października 2024
10 Października 2024
9 Października 2024
9 Października 2024
9 Października 2024
9 Października 2024
Mega Bloks Despicable Me - Micro Action Figures Series 10 Instrukcja
9 Października 2024Mega Bloks Buildable Minions Blind Packs Series III Instrukcja
9 Października 2024