5 X 7 LED Matrix Dis..

advertisement
5 X 7 LED Matrix Display Project V1.0
Package designed by
Allan Byres
H.J.Cambie Secondary School
Rationale:
This project came about while I was teaching level 3 electronics students how to use the
PIC micro-controller. I had followed my usual routine of teaching through experiments
or labs as I routinely call them. The students had learned the PIC basic commends to
light LED’s and make various display patterns on both the A and B ports.
I was frustrated by the lack of something practical and useful to do with them at this
point. They wanted a project and I didn’t have one except for robotics. So continuing
the theme of LED displays which are easy enough I needed a challenge and I came
across this project that is sold as a kit on the internet but unfortunately uses assembly
language. (…unfortunate because I am not proficient in it!)
You can find it here…
http://www4.tpg.com.au/users/talking/5x7%20Display%20Index.html
I also came across this web site that offered some useful information and the same
components, huge bonus!
http://drew.hickmans.net/movingsign.htm
So I was off to the races and had a project. The example in the picture is my prototype
and I have had it working showing a simple flashing message.
The steps following are those that I follow and you will notice that I have assumed some
basic pic programming knowledge and how to use the programming software and the Tpic programming board created and sold by Ian Mathie and Paul Wytenbroek at BCIT.
Students need to be familiar with the pic and be able to do some programming. They
need to be comfortable with the three pieces of computer software and the workings of
a bread-board and IC’s.
Before completing this project I would have students’ complete The intro labs 1 through
6 which take them through all of the PIC Basic commands necessary.
5 x 7 Display Explanation
2
Only one column (vertical) of LEDs turns on at a time. Seven of the lines of port B drive
the LEDs via 100R resistors and the cathodes are connected together and taken to the
0 V rail via a "sinking" transistor. The 5 sinking transistors are turned on (one at a time)
by the outputs of a CD 4017 "counter" chip. This chip has 10 outputs with one output
going HIGH at a time. The chip is firstly reset by taking pin 15 HIGH then LOW and
keeping the line low - this allows the chip to "clock."
The first output (pin 3 on the 4017) goes HIGH and this is connected to the first
transistor via a 2k2 base resistor. The transistor turns on and the cathodes of the first
column of LEDs connect to the 0v rail.
The LEDs are turned ON by delivering current from the PIC chip. When any of the
output lines of the PIC go HIGH (RB0 to RB6), the corresponding LED(s) are illuminated.
The 100R resistor limits the current to about 25 mA, as this is the maximum each
output is designed to deliver.
The output lines of the chip correspond to Port B and by turning off these lines, clocking
the 4017 then turning on the outputs again, the second column of LEDs will be
illuminated. This is repeated for
the 3rd, 4th and 5th columns.
When this is repeated at a rate
above 50 times per second, the
whole screen of LEDs appears to
be ON at the same time. This is
how a picture or effect is
produced on the screen - it's
called scanning.
The 4017
In order to understand how this
project will work we need to have
a good understanding of how the
4017 works. It is an integral part
of this particular display. It’s
cheap and commonly available and
simple to use. There are other
options such as using the other
unused parts of the PIC (A Port) but I eventually want to have two 4017’s and connect
up fours 5 X 7’s allowing a
3
20 X 7 display as shown below.
The
following
labs are
designed to
help us to
learn how
the 4017
works and
how to use
it
effectively
to control
each
column.
4017 Lab 1
Each student must complete this lab individually. (Two periods maximum)
Refer to the construction notes below (step 4)
The purpose of this lab is to learn how the 4017 activates each output pin and
makes it “high” in turn when given a clock pulse on pin 14. Also how to reset the
4017 at any point using the RESET pin (# 15)
4
1) On a T-pic bread board build the following circuit:
o 4017 decade counter IC
o 5 LEDs which connect to the 4017 output pins in numerical order as in
the construction notes. (no transistor is necessary at this time. Each
led should have its cathode connected to ground)
o Power connections to the 4017 (from PIC Board) and PIC connections
to pins A0 and A1, where pin A0 connects to the clock pin and A1 to
the reset pin. (see Construction Notes below)
o Follow all Bread boarding conventions!
o Get it checked and signed here: ______________________
2) Write a PIC Basic program that will turn on each LED in order one through
five, activate the reset switch, then go back and do it again.
o Include enough comments to make it easy to understand.
o Test it and modify the program if necessary!
o Save It as your initials “4017_1”
4)
4017 Info
Construction Notes
Pins 13 and 15 are important to the correct operation of the 4017. Pin 13 should
be connected to ground or 0V for your labs. Pin 15 needs to change state. If pin
15 stays connected to ground the counter will advance from outputs 0 to 9 and
the repeat. If we change its state to high it resets the counter and starts from 0
again!
5
4017 Lab 2
Each student must complete this lab individually. (One period Only)
The purpose of this lab is to investigate the display project and to work towards
the creation of at least one letter or shape.
Task 1
Write a program to light up a whole column one LED at a time moving from top to
bottom and then reverse it by turning off one led at a time. Use the same
schematic diagram as for lab 1. Save your program on your own disk as 4017_2.
Get it marked and demonstrate it to Mr. B
Task 2
The matrix is a 5 x 7 rectangle. Your function here is to decide on one letter,
shape, icon or anything else that is not vulgar in any way!
Shade in the relevant blocks below.
Fill in the blanks:
Each vertical column is controlled by the:
_______________________________
Each horizontal Row is controlled by the:
________________________________
The 4017-decade counter has ten
output pins, Note the order in
which they occur!
Also Note that pin 14 is the Clock
and Pin 15 is the Reset Pin.
Remember it is a CMOS device!!
Handle with care
6
The idea of persistence of vision means that we don’t in fact have to light all the columns
at the same time but rather we will light up one at a time. So long as we do it fast enough we
should see the character show up! This means that each column should be on for ___ of a
second or less!
Task 3
Calculate the decimal number necessary to turn on the correct LED’s in each column of the
character you have shaded in the table above. Write it next to the corresponding row number
below:
1)
2)
3)
4)
5)
Build a display board.
Before we can carry on you will need to build a display board or access at least one
commercial display that will suit this project. The following is a circuit board that will
allow you to build your own.
The schematic:
for transistors any small NPN
transistor will work(2N3049)
7
4017 Lab 3
So far we have worked with a single vertical column and we have had the 4017 light up an
led on each pin. The combination of this is what we seek to achieve in order to create a
display
Purpose:
The purpose of this lab is to get a simple display to show up on the board you have
designed and built. You have already created a simple design that you will now use.
Task 1: One column moving
The first task is to combine the knowledge gained and create a moving column of light.
The column should move from left to right across the display. Write a program that will
do this. As always keep notes on what you are doing and each change you make. This will
help you to keep track of things. Also make sure you comment on you program.
Hints: remember that the reset must occur each time to move to the next column.
Go back to the basic explanation on page 3 if you need to review.
A short pause time s necessary or else the display
Save your program as 4017_31
Task 2:
Now rewrite the program from task 1 above to show the single character you designed.
Save it as 4017_32 on your disk.
8
Download