Joy-it RB-LCD-16x2 Bedienungsanleitung
Lesen Sie kostenlos die đ deutsche Bedienungsanleitung fĂŒr Joy-it RB-LCD-16x2 (15 Seiten) in der Kategorie Speelgoed. Dieser Bedienungsanleitung war fĂŒr 7 Personen hilfreich und wurde von 2 Benutzern mit durchschnittlich 4.5 Sternen bewertet
Seite 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
Produktspezifikationen
Marke: | Joy-it |
Kategorie: | Speelgoed |
Modell: | RB-LCD-16x2 |
Brauchst du Hilfe?
Wenn Sie Hilfe mit Joy-it RB-LCD-16x2 benötigen, stellen Sie unten eine Frage und andere Benutzer werden Ihnen antworten
Bedienungsanleitung Speelgoed Joy-it
20 August 2024
20 August 2024
Bedienungsanleitung Speelgoed
- Speelgoed Crivit
- Speelgoed BeeWi
- Speelgoed Velleman
- Speelgoed IKEA
- Speelgoed Carrera
- Speelgoed ARCHOS
- Speelgoed Ingo
- Speelgoed GoGEN
- Speelgoed PetSafe
- Speelgoed Chicco
- Speelgoed Hauck
- Speelgoed Lorelli
- Speelgoed Biltema
- Speelgoed Fisher-Price
- Speelgoed Peg Perego
- Speelgoed Snow Joe
- Speelgoed Syma
- Speelgoed Merlin
- Speelgoed Vtech
- Speelgoed KidKraft
- Speelgoed Kinderkraft
- Speelgoed Kayoba
- Speelgoed BRIO
- Speelgoed Falk
- Speelgoed Ravensburger
- Speelgoed Playmobil
- Speelgoed SereneLife
- Speelgoed Hudora
- Speelgoed Mattel
- Speelgoed EXIT
- Speelgoed Jumbo
- Speelgoed Hasbro
- Speelgoed IMC Toys
- Speelgoed Spin Master
- Speelgoed Viper
- Speelgoed Quadro
- Speelgoed DS
- Speelgoed Exit Toys
- Speelgoed Geomag
- Speelgoed Huffy
- Speelgoed Jamara
- Speelgoed Kids Knex
- Speelgoed Knex
- Speelgoed Lego
- Speelgoed Little Tikes
- Speelgoed Marklin
- Speelgoed Mega Bloks
- Speelgoed Megableu
- Speelgoed MJX
- Speelgoed MNKY
- Speelgoed Outdoor Play
- Speelgoed Playtive
- Speelgoed Plusbricks
- Speelgoed Rayline
- Speelgoed Salta
- Speelgoed Silvergear
- Speelgoed Skippy Buddy
- Speelgoed SpinMaster
- Speelgoed Steren
- Speelgoed Sunny
- Speelgoed Tamiya
- Speelgoed Tiamo
- Speelgoed Chipolino
- Speelgoed Unico Plus
- Speelgoed Wilesco
- Speelgoed WowWee
- Speelgoed X4-Tech
- Speelgoed Yuneec
- Speelgoed AXI
- Speelgoed Alpha
- Speelgoed Valk
- Speelgoed BIG
- Speelgoed Lenoxx
- Speelgoed Step2
- Speelgoed Baby Annabell
- Speelgoed Triumph Sports
- Speelgoed Schleich
- Speelgoed Style Me Up
- Speelgoed Arctic Cooling
- Speelgoed DreamGEAR
- Speelgoed Hurtle
- Speelgoed Dickie
- Speelgoed Thames & Kosmos
- Speelgoed Kemo
- Speelgoed Kindercraft
- Speelgoed E-flite
- Speelgoed Snap Circuits
- Speelgoed Backyard Discovery
- Speelgoed Makeblock
- Speelgoed Bruder
- Speelgoed Nerf
- Speelgoed AquaPlay
- Speelgoed Pardini
- Speelgoed Bullet
- Speelgoed Polly Pocket
- Speelgoed Nils Fun
- Speelgoed Invento
- Speelgoed Nordic Play
- Speelgoed Propel
- Speelgoed Rovo Kids
- Speelgoed Atomik
- Speelgoed Clics
- Speelgoed Dynacraft
- Speelgoed Jobe
- Speelgoed Rolly Toys
- Speelgoed Elenco
- Speelgoed Gel Blaster
- Speelgoed Swurfer
- Speelgoed Valley Dynamo
Neueste Bedienungsanleitung fĂŒr -Kategorien-
18 September 2024
18 September 2024
18 September 2024
18 September 2024
18 September 2024
18 September 2024
18 September 2024
18 September 2024
18 September 2024
18 September 2024