march 2014 - islamic university of gaza
Post on 17-Apr-2022
9 Views
Preview:
TRANSCRIPT
March 2014
5
2 Embedded Systems Lab
Objectives
1. To be familiar with Graphical LCD displays.
2. To be familiar with LED Dot-Matrix display.
Graphical LCD
Graphical LCDs allows creating more elaborate visual messages than usual
alphanumerical (character) LCDs can provide, involving graphics (bitmaps
pictures, drawings and shapes) and characters.
Controllers
The most important consideration in choosing an LCD display is the
controller. An LCD display without a controller needs to be refreshed at a fast
enough rate to prevent flickering. The most popular, though slightly
outdated standard is the T6963C controller made by Toshiba.
GLCD & Led-Matrix
3 Embedded Systems Lab
T6963C Graphic Lcd Library
Mikrobasic for PIC provides a library for working with Glcds based on
TOSHIBA T6963C controller. The Toshiba T6963C is a very popular Lcd
controller for the use in small graphics modules. It is capable of controlling
displays with a resolution up to 240x128. Because of its low power and small
outline it is most suitable for mobile applications such as MP3 players or
mobile measurement equipment. Although small, this controller has a
capability of displaying and merging text and graphics and it manages all the
interfacing signals to the displays Row and Column drivers.
For creating a custom set of Glcd images use Glcd Bitmap Editor Tool.
GLCD Modes
- Graphics mode (for pictures, drawings and shapes)
- Text mode (for characters)
Both modes have specific routines for activating mode and making a
command to draw, load image and write text.
At Proteus: PG128128A
LCD graphics displays come in a variety of sizes. In this lab we will work with
PG128128A LCD (128 * 128 _size) that have T6963C controller Use
mikrobasic T6963C Graphic LCD Library to program such LCDs.
4 Embedded Systems Lab
Library Routines
Example: T6963C_init(128, 128, 8, PORTB, PORTD, 3, 2, 1, 5)
- init display for 128 pixel width and 128 pixel height
- 8 bits character width
- data bus on PORTB
- control bus on PORTD
- bit 3 is !WR (write- Look at GLCD pins: wr: active low)
- bit 2 is !RD (read)
- bit 1 is !CD (command/data)
- bit 5 is RST (reset)
5 Embedded Systems Lab
For activating text mode
For writing texts
6 Embedded Systems Lab
For activating graphics mode
For drawing rectangle
7 Embedded Systems Lab
For viewing an image
In order to load an image into GLCD, this image must have many properties which
are generated by many steps as the following procedure shows:
Wanted specifications => 128 * 128 pixels monochrome (black & white)
bitmap image
1. Open the image using paint “open with paint” >> Get the wanted size
using Resize icon >> choose pixels <<un-tick ratio << enter 128*128 for the
size.
8 Embedded Systems Lab
2. Save as >> Monochrome Bitmap (with Arabic versions: أحادية اللون )
3. Now your image is ready to be used with GLCD
4. Use Mikrobasic tool GLCD bitmap editor from tools menu.
5. From T6963c tab choose the appropriate value for GLCD size/controller
according to your LCD size: 128*128.
6. Load the bmp picture from load button << you can also invert colors >>
7. An automated code will be generated for this picture.
8. Choose mikrobasic code from the bottom right list.
9. Copy the generated mikrobasic code to clipboard and paste it into your
program << before the main >>.
9 Embedded Systems Lab
Proteus
1. Write a basic program to display the following figure on
the GLCD: Draw triangle then view an image with a text
like following figure.
2. Simulate the circuit using Proteus ISIS program.
Lab Work 1
10 Embedded Systems Lab
Mikrobasic
How to think …
In order to draw the rectangle then write a text with an image, we must
firstly think of the arrangement of the functions (in general):
- Initiate the GLCD
- Enable graphics mode
- Draw rectangle
- View image
- Enable text mode
- Write a text
You can use T6963C_init
instead of these
11 Embedded Systems Lab
Some important notes (code will be your own task, do it by yourself )
Initiate the glcd << enable text mode << write a message <<write ‘*’ at each button
test << if password is correct: write the name, enable graphics mode and load image
<< else do the suitable actions << do suitable work for reset.
1. Improve your application by replacing the lcd with glcd
<< Enter your password message << numbers as ‘*’ <<
when button is checked, if password is correct, show
the user’s photo and his name, else show warning
message>>
2. - edit reset part using glcd
Application - Part 3
12 Embedded Systems Lab
LED Dot Matrix Display
A dot matrix is a 2-dimensional array of dots used to represent characters, symbols
and images. Typically the dot matrix is used in many digital display devices. In
displays, the dots light up, as in an LED or CRT display. Led matrix display can show
pictures and words, and RGB led matrix even can show video.
LED matrix has the size from 0.7'' to 4.6''. According to its dot arrangements, LED
dot matrix display also can be divided into 5*7 dot matrix, 5*8 dot matrix and 8*8
dot matrix. Actually there are also led matrix consists of led lamps.
Internal connection of the Dot-matrix display illustrates its idea of work. Note that
every LED is simply a diode that lights when you put it in a circuit with a drop
voltage. So using MCU we are going to loop over every column and supply the right
voltage and ground values.
For every led to be shined:
VCC must be connected to
the column and GND to
the row
13 Embedded Systems Lab
How it works
The LED matrix used in this lab is of size 5×7. We will learn how to display still
characters in a standard 5×7 pixel format. The figure below shows which LEDs are to
be turned on to display the English alphabet ‘A’. The 7 rows and 5 columns are
controlled through the microcontroller pins. Now, let’s see in detail how it works.
Suppose, we want to display the alphabet A. We will first select the column C1
(which means C1 is pulled low in this case), and deselect other columns by blocking
their ground paths (one way of doing that is by pulling C2 through C5 pins to logic
high). Now, the first column is active, and you need to turn on the LEDs in the rows
R2 through R7 of this column, which can be done by applying forward bias voltages
to these rows. Next, select the column C2 (and deselect all other columns), and
apply forward bias to R1 and R5, and so on. Therefore, by scanning across the
column quickly and turning on the respective LEDs in each row of that column, the
persistence of vision comes in to play, and we perceive the display image as still.
14 Embedded Systems Lab
The table below gives the logic levels to be applied to R1 through R7 for each of the
columns in order to display the alphabet ‘A’.
At proteus : matrix-5x7 At hardware
15 Embedded Systems Lab
For ‘A’ letter-the const is: 7E,11,11,11,7E
In order to load these values to the led**matrix using pic code, we can do the
following:
For all characters and numbers values use the following constant to display on
DotMatrix, every character has 5-values as a constant array.
- Columns are connected to portd << rows at portb
- Code will be:
For i = 0 to 50 ‘reload every character to be shown for the user
Portd= 0x01
Portb=Not 0x7E ‘in order to get the wanted char. As a shining
one on an un-shined background (led-matrix inverses 0/1)
Delay_ms(10)
Portd= 0x02
Portb= Not 0x11
‘repeat previous code for other columns and values
const font as byte[215] = (
$7E,$11,$11,$11,$7E, 'A
$7F,$49,$49,$49,$36, 'B
$3E,$41,$41,$41,$22, 'C
$7F,$41,$41,$22,$1C, 'D
$7F,$49,$49,$49,$41, 'E
$7F,$09,$09,$09,$01, 'F
16 Embedded Systems Lab
$3E,$41,$49,$49,$7A, 'G
$7F,$08,$08,$08,$7F, 'H
$00,$41,$7F,$41,$00, 'I
$20,$40,$41,$3F,$01, 'J
$7F,$08,$14,$22,$41, 'K
$7F,$40,$40,$40,$40, 'L
$7F,$02,$0C,$02,$7F, 'M
$7F,$04,$08,$10,$7F, 'N
$3E,$41,$41,$41,$3E, 'O
$7F,$09,$09,$09,$06, 'P
$3E,$41,$51,$21,$5E, 'Q
$7F,$09,$19,$29,$46, 'R
$46,$49,$49,$49,$31, 'S
$01,$01,$7F,$01,$01, 'T
$3F,$40,$40,$40,$3F, 'U
$1F,$20,$40,$20,$1F, 'V
$3F,$40,$38,$40,$3F, 'W
$63,$14,$08,$14,$63, 'X
$07,$08,$70,$08,$07, 'Y
$61,$51,$49,$45,$43, 'Z
$3E,$51,$49,$45,$3E, '0
$00,$42,$7F,$40,$00, '1
$42,$61,$51,$49,$46, '2
$21,$41,$45,$4B,$31, '3
$18,$14,$12,$7F,$10, '4
$27,$45,$45,$45,$39, '5
$3C,$4A,$49,$49,$30, '6
$01,$71,$09,$05,$03, '7
$36,$49,$49,$49,$36, '8
$06,$49,$49,$49,$3E, '9
$00,$00,$00,$00,$00, '
$08,$08,$3E,$08,$08, '+
$08,$08,$08,$08,$08, '-
$00,$60,$60,$00,$00, '.
$14,$08,$3E,$08,$14, '*
$00,$36,$36,$00,$00 ':
)
17 Embedded Systems Lab
In order to feel free for choosing your own characters and showing them on led-
matrix, you can implement normal or custom characters by drawing them and get
their constants array using: MikroElektronica GLCD Font Creator program.
Download it from here
Steps of work will be like this:
1. Create new font >> enter name and change size to 5x7
18 Embedded Systems Lab
2. Grid layout will appear like this
3. Draw your own character, then pess at its place to save it
To get a const for the char. Clear invert colors
Press
here
19 Embedded Systems Lab
4. Your charcters is saved, get its constant array
5. Copy and baste the code in your project before the main
Addresses of
characters
Change them
according to your
characters addresses
20 Embedded Systems Lab
Proteus
1. Write a basic program that displays the letters from A to H
on the led Matrix.
2. Simulate the circuit using Proteus ISIS program.
3. Connect the circuit at the hardware kit.
Lab Work 2
21 Embedded Systems Lab
Code
After drawing letters A-F and getting their const. arrays, we must use a loop for
showing them on the led-matrix instead of traditional way for loading every value
to the port for every character.
Mikrobasic
‘ << ‘ shift number left
by one position
Portd: 00000001
00000010
00000100
00001000
00010000
22 Embedded Systems Lab
If you inverse ports << If you use portb for columns, the same work will not give
the same results!!
- If you work with portb, cancel RB0 from your cade:
- RB0 have a problem with shift operator ’ << ‘.
- Start to enable the first column normally
by changing code and simulation like this:
Warning!
23 Embedded Systems Lab
… Good Luck …
1. Write a basic program to display the following figure (use
your name & ID) on the GLCD (implement the design as much
as possible).
2. Write a basic program that displays the numbers from 0 to 9
on the led Matrix.
3. Do Application-Part2 and include it at the report.
Homework
top related