Joy-it RB-LCD-16x2 Manual de Usario
Lee a continuación 📖 el manual en español para Joy-it RB-LCD-16x2 (15 páginas) en la categoría juguetes. Esta guía fue útil para 2 personas y fue valorada con 4.5 estrellas en promedio por 2 usuarios
Página 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
Especificaciones del producto
Marca: | Joy-it |
Categoría: | juguetes |
Modelo: | RB-LCD-16x2 |
¿Necesitas ayuda?
Si necesitas ayuda con Joy-it RB-LCD-16x2 haz una pregunta a continuación y otros usuarios te responderán
juguetes Joy-it Manuales
2 Septiembre 2024
1 Septiembre 2024
1 Septiembre 2024
juguetes Manuales
- juguetes IKEA
- juguetes Ravensburger
- juguetes VTech
- juguetes Lego
- juguetes MJX
- juguetes Crivit
- juguetes BeeWi
- juguetes SereneLife
- juguetes Smoby
- juguetes Chicco
- juguetes Huffy
- juguetes Jumbo
- juguetes Easypix
- juguetes Berg
- juguetes Velleman
- juguetes Hauck
- juguetes Sunny
- juguetes Easymaxx
- juguetes GoGEN
- juguetes Steren
- juguetes Mattel
- juguetes Lorelli
- juguetes Fisher Price
- juguetes Biltema
- juguetes DJI
- juguetes Viessmann
- juguetes Peg Perego
- juguetes Kayoba
- juguetes Salta
- juguetes Little Tikes
- juguetes Kinderkraft
- juguetes Viper
- juguetes Playmobil
- juguetes Tamiya
- juguetes Amigo
- juguetes Lionelo
- juguetes Petsafe
- juguetes Hasbro
- juguetes Ingo
- juguetes Exit
- juguetes Plum
- juguetes Carrera
- juguetes Spin Master
- juguetes DS
- juguetes Syma
- juguetes Megableu
- juguetes Chipolino
- juguetes Valk
- juguetes Alpha
- juguetes Wilesco
- juguetes Arctic Cooling
- juguetes FABER CASTELL
- juguetes IMC Toys
- juguetes Marklin
- juguetes Mega Bloks
- juguetes WowWee
- juguetes Nerf
- juguetes KidKraft
- juguetes Geomag
- juguetes Yuneec
- juguetes Bellelli
- juguetes AXI
- juguetes Knex
- juguetes Falk
- juguetes Silvergear
- juguetes Rayline
- juguetes Pardini
- juguetes Svexia
- juguetes Fast Rider
- juguetes Plusbricks
- juguetes Playtive
- juguetes Kogan
- juguetes Lenoxx
- juguetes Backyard Discovery
- juguetes Kemo
- juguetes Snap Circuits
- juguetes Rainbow
- juguetes BIG
- juguetes Dynacraft
- juguetes Cosco
- juguetes Step2
- juguetes Quadro
- juguetes Jamara
- juguetes Starlyf
- juguetes Merlin
- juguetes E-flite
- juguetes Playland
- juguetes Hurtle
- juguetes Jobe
- juguetes WLtoys
- juguetes Style Me Up
- juguetes Bruder
- juguetes Hudora
- juguetes Rolly Toys
- juguetes ProSin
- juguetes SpinMaster
- juguetes Kindercraft
- juguetes Tot Tutors
- juguetes Dario
- juguetes Invento
- juguetes Estes
- juguetes Air Wars
- juguetes Radio Flyer
- juguetes Pedalo
- juguetes Millennium
- juguetes Webley
- juguetes Polly Pocket
- juguetes AquaPlay
- juguetes Teksta
- juguetes Trigano-Jardin
- juguetes Promedia
- juguetes Triumph Sports
- juguetes Bullet
- juguetes Schleich
- juguetes Propel
- juguetes Elenco
- juguetes Gel Blaster
- juguetes Nils Fun
- juguetes Nordic Play
- juguetes Swurfer
- juguetes Atomik
- juguetes Valley Dynamo
Últimos juguetes Manuales
27 Octubre 2024
27 Octubre 2024
27 Octubre 2024
27 Octubre 2024
27 Octubre 2024
27 Octubre 2024
27 Octubre 2024
27 Octubre 2024
27 Octubre 2024
26 Octubre 2024