LED Matrix 8x8led
Transcript of LED Matrix 8x8led
-
8/11/2019 LED Matrix 8x8led
1/34
LED Matrix 8x8
-
8/11/2019 LED Matrix 8x8led
2/34
LED Matrix
A LED Matrix is an array of leds used to
generate characters, symbols and images Several single LED Matrices can be combined
to create a larger LED Matrix
-
8/11/2019 LED Matrix 8x8led
3/34
LED Matrix Types
Color type
1. MonoColor: Green or Red or Yellow
2. BiColor: Red and Green
3. RGB: Red, Green and Blue
Pole type1. Led Anode in the row
2. Led Anode in the column
-
8/11/2019 LED Matrix 8x8led
4/34
Inside an 8x8 LED Matrix
An 8x8 monocolor LEDMatrix includes 64LEDs arranged in 8rows and 8 columns
R0R1R2R3
R4R5R6R7
C0C1 C2 C3C4C5 C6C7
An 8x8 bicolor LED Matrix (RED,
GREEN) includes 64 pairs of red andgreen LEDs arranged in 8 rows and 8columns
COL
ROW
0 1 2 3 4 5 6 7
7
6
543
2
1
0
-
8/11/2019 LED Matrix 8x8led
5/34
The Chinese LED Matrix Part No.For example:
L M M - 1 5 8 8 X
15 means 1.5 inches for the size of the LED Matrix
88 means 8 columns and 8 rows
X : LED Matrix type
A : Anode in the Row (Cathode in the Column)
B : Anode in the Column (Cathode in the Row)
-
8/11/2019 LED Matrix 8x8led
6/34
How a MonoColor LED Matrixworks?
R0
R1
R2
R3
R4
R5
R6R7
C0 C1 C2 C3 C4 C5 C6 C7
8 pins R0-R7 to control rows and 8
pins C0-C7 to control columns.
For the Row-Anode LED Matrix:
5V to enable the row
0V to enable the column
For Column-Anode LED Matrix:
0V to enable the row
5V to enable the column
-
8/11/2019 LED Matrix 8x8led
7/34
The BiColor LED Matrix
(Red & Green)
There are: 8 pins to control the rows
16 pins to control the columns,including 8 pins for Red LEDs
8 pins for Green LEDs
-
8/11/2019 LED Matrix 8x8led
8/34
Turning on 1 LED on a Row-Anode LED Matrix
1. Enable row position pin and disable otherrow pins
2. Enable the column position pin and disableother column pins
Note: Because of using the NOT ports, set5V to enable one column
Example: To turn on the Row-Anode LED atRow R4, Column C6:
1. Set 5V to R4 (enabled) and other row pins to
0V (disabled)
2. Set 5V to C6 (enabled) and other columnpins to 0V (disabled)
COL0 1 2 3 4 5 6 7
ROW
76
543210
0V 0V 0V 0V 0V 0V 5V 0V
C0 C1 C2 C3 C4 C5 C6 C7
R0
R1
R2R3
R4
R5
R6R7
0V
0V
0V0V
5V
0V
0V0V
-
8/11/2019 LED Matrix 8x8led
9/34
Developing a Program to Turn On
one LED on the LED Matrix
-
8/11/2019 LED Matrix 8x8led
10/34
Connecting the Cables1. Connect B0-B7 to the
jumper row control 1-8
2. Connect C0-C7 to thejumper green control 1-8 (orthe jumper red control)
JUMPER GREEN
CONTROL
PORT B PORT C
JUMPER ROW
CONTROL
JUMPER RED
CONTROL
-
8/11/2019 LED Matrix 8x8led
11/34
Electronic Schema
-
8/11/2019 LED Matrix 8x8led
12/34
#include
#include "led_matrix_8x8_driver.c"
#use delay(clock = 4MHz, crystal)
void main() {
while (true)turn_on_pixel(4, 6);
}
-
8/11/2019 LED Matrix 8x8led
13/34
Controlling 1 Row on Anode-Row LED Matrix
1. Set an 8-bit data to the column pins
Note: Because of using the NOT ports, set5V to enable one column
2. Enable the chosen row and disable theother rows
Example: Display 01010101 on row R4
1. Set 01010101 to the column pins
2. Set 5V to R4 and 0V to others
COL
ROW
0 1 2 3 4 5 6 776
543210
R0
R1
R2
R3
R4
R5
R6R7
0V
0V
0V
0V
5V
0V
0V0V
C0 C1 C2 C3 C4 C5 C6 C75V 0V 5V 0V 5V 0V 5V 0V
-
8/11/2019 LED Matrix 8x8led
14/34
Developing a Program to
Control One Row on the LEDMatrix
-
8/11/2019 LED Matrix 8x8led
15/34
#include #include "led_matrix_8x8_driver.c"
#use delay(clock = 4MHz, crystal)
void main() {byte pattern = 0b01010101 ;
int8 row_no = 4;while (true)
display_pattern_on_row(pattern, row_no );}
-
8/11/2019 LED Matrix 8x8led
16/34
Controlling 1 Column on an Anode-Row LED Matri
R0
R1
R2R3
R4
R5
R6R7
C0C1 C2 C3 C4 C5 C6 C7
5V
0V
5V0V
5V
0V
5V0V
0V0V 5V 0V 0V0V 0V 0V
COL
ROW
0 1 2 3 4 5 6 776
543210
1. Set an 8-bit data to the row pins
2. Enable the chosen column and
disable the other columns
Note: Because of using the NOTports, set 5V to enable onecolumn
Example: Display 01010101 oncolumn C2
Set 01010101 to the row
pins Set 5V to C2 and 0V to
others
-
8/11/2019 LED Matrix 8x8led
17/34
Developing a Program to
Control One Colunm on theLED Matrix
-
8/11/2019 LED Matrix 8x8led
18/34
Solution 1
#include #include "led_matrix_8x8_driver.c"
#use delay(clock = 4MHz, crystal)
void main() {
byte pattern = 0b01010101;int8 col_no = 2;while (true)
display_pattern_on_col (pattern, col_no);
}
-
8/11/2019 LED Matrix 8x8led
19/34
Solution 2
#include #include "led_matrix_8x8_driver.c"
#use delay(clock = 4MHz, crystal)
void main() {byte pattern = 0b10101010;byte col_2 = 0b00000100;while (true)
display_pattern_on_ bit_col (pattern, col_2 );}
-
8/11/2019 LED Matrix 8x8led
20/34
Displaying an 8x8 Pattern on an Anode-Row
LED Matrix
We use the columns for controlling and therows for displaying data
Display each column in turn and delay 100us
There is just 1 column lighting at a time.But due to the
Persistence of VisionPhenomenon, we can see the whole patternon the LED Matrix
COL
ROW
0 1 2 3 4 5 6 7
7
6
5
4
3
2
1
0
-
8/11/2019 LED Matrix 8x8led
21/34
Developing a Program to
Display an 8x8 Pattern on theLED Matrix
-
8/11/2019 LED Matrix 8x8led
22/34
Solution#include #include "led_matrix_8x8_driver.c"
#use delay(clock = 4MHz, crystal)
// C 0 1 2 3 4 5 6 7
// R0 * * * * *
// R1 * * * *
// R2 * * * *
// R3 * * * * *
// R4 * * * * *
// R5 * * * *
// R6 * * * *
// R7 * * * * *
// FF FF 99 99 FF 66 00 00
void main() {int8 char_B[] =
{0xff, 0xff, 0x99, 0x99, 0xff, 0x66, 0x00, 0x00};while (true)
display_pattern(char_B);}
-
8/11/2019 LED Matrix 8x8led
23/34
-
8/11/2019 LED Matrix 8x8led
24/34
Turn On a Pixel on a LED Matrix
-
8/11/2019 LED Matrix 8x8led
25/34
void turn_on_pixel(int8 row, int8 col)
void turn_on_pixel(int8 row, int8 col) {
output_b(shift_left_0x01(row));
output_c(shift_left_0x01(col));
}
int8 shift_left_0x01 (int8 n_times) {
return (0x01
-
8/11/2019 LED Matrix 8x8led
26/34
Display a Pattern on a Row of a
LED Matrix
-
8/11/2019 LED Matrix 8x8led
27/34
void display_pattern_on_row(int8 row_pattern,
int8 row_num)
void display_pattern_on_row(int8 row_pattern,int8 row_num) {
output_c(row_pattern);
output_b(shift_left_0x01(row_num));
}
-
8/11/2019 LED Matrix 8x8led
28/34
Display a Pattern on a Column of a
LED Matrix
-
8/11/2019 LED Matrix 8x8led
29/34
Solution 1
-
8/11/2019 LED Matrix 8x8led
30/34
void display_pattern_on_col(int8 col_pattern,
int8 col_num)
void display_pattern_on_col(int8 col_pattern, int8col_num) {
output_b(col_pattern);
output_c(shift_left_0x01(col_num));
}
-
8/11/2019 LED Matrix 8x8led
31/34
-
8/11/2019 LED Matrix 8x8led
32/34
void display_pattern_on_bit_col(int8
col_pattern, int8 bit_col)
void display_pattern_on_bit_col(int8
col_pattern, int8 bit_col) {output_b(col_pattern);
output_c(bit_col);}
-
8/11/2019 LED Matrix 8x8led
33/34
Display an 8x8 Pattern on a LED
Matrix
-
8/11/2019 LED Matrix 8x8led
34/34
void display_col_patterns(int8 col_patterns[])
void display_col_patterns(int8 col_patterns[]) {
int8 col;
int8 bit_col = 0x01;for (col = 0; col < 8; col++) {
display_pattern_on_bit_col(col_patterns[col], bit_col);
delay_us(100);
turn_off_led_matrix();
bit_col