microcontroller based matrix led
project
1. First Application
Introduction
The best thing to do with the matrix;
is to draw any image and to animate the image.
For me, I decide to diagram a smiling
simple face and then change the figure and make it sad, so I'm alternating
between the smiling face and the sad face; every second the LED matrix 8 * 8
changes the state of the face.
I realize this project using
professional ISIS simulation software and other programming software MICRO C.
components
used
• Matrix LED 8 * 8.
• Microcontroller pic
16F877.
MATRIX
There are many type of matrix LED
8 * 8, 5 * 7 16 * 16, 32 * 32 ...
All the matrix have:
lines which connect each anode
of a line of LED.
columns that connect each LED kathode of
a column
in my application I connect all the
columns in port B and all the lines PORTC
Microcontroller 16F877
PIC micro structure
The microcontroller is a digital
component that can accept data in analog and digital form. To use it you must
determine how the pins (pins) of the microcontroller will be used: inputs or
outputs.
For example on the 16F877A component
below the pin 2 is labeled RA0 / AN0.this means that pin 2 can be used as an
input or output (RA0 = "bit" of 0 or 1) or as an analog input (AN0)
with voltage ranges from 0V to + VDD
We must properly configure the
microcontroller before using the component
The microcontroller can be programmed
in C or assembler.
The 16F877A has 5 ports assigned
letters A, B, C, D, E. Each pin of a port is identified by a number for the
port A RA0 to RA5 to port B of RB0 to RB7 etc. we notice for this microcontroller , port A has
6 pins ,port B 8 pins as the ports C and
D and the port E owns only 3.
This means that we can connect for
example 6 inputs (sensors) or output (LEDs or motors) on port A, 8 on port B.
Some pin has multiple functions such as
denoted 25 pin RC6 / TX / CK.
RC6: input or output bit 6 of port B.
TX: Transmission of serial programming
interface.
CX: clock (Clock) of the serial
interface.
Ports are hard links of your program
with the external environment (sensor, display, engine etc.).
The ports are connected to the internal
circuitry of the PIC via an 8 bit bus system.
Internal structure of the pic
Circuit project on ISIS
smiling
face
Sad
face
Programmation
Void main () {
Char i;
TRISB = 0X00;
TRISC = 0X00;
PORTB = 0X00;
PORTC = 0X00;
While (1){
For (i=0;i<100;i++)
{
Portb = 0XC3;
portc = 0X81;
delay_ms(1);
portb = 0XBD;
portc = 0X42;
delay_ms(1);
portb = 0X7E;
portc = 0X24;
delay_ms(1);
portb = 0X7E;
portc = 0X18;
delay_ms(1);
portb = 0XFB;
portc = 0X18;
delay_ms(1);
portb = 0XD7;
portc = 0X24;
delay_ms(1);
portb = 0X7E;
portc = 0X18;
delay_ms(1);
portb = 0XD7;
portc = 0X24;
delay_ms(1);
}
delay_ms(20);
for(i=0;i<100;i++)
{
portb = 0XC3;
portc = 0X81;
delay_ms(1);
portb = 0XBD;
portc = 0X42;
delay_ms(1);
portb = 0X7E;
portc = 0X24;
delay_ms(1);
portb = 0XF7;
portc = 0X18;
delay_ms(1);
portb = 0X7E;
portc = 0X18;
delay_ms(1);
portb = 0XDB;
portc = 0X24;
delay_ms(1);
portb = 0XF7;
portc = 0X18;
delay_ms(1);
}
}
}
0 Commentaires