Professional Documents
Culture Documents
unit
U.S. Muthugala / February 25, 2012
Introduction
The main purpose of a display unit is to display information and other visual graphics to a particular
audience. Over the years various types of display systems were developed and are being used to display
information and to provide entertainment in various situations.
Neon display signs were a popular signage method in the past but once a display is designed its
impossible to do any modifications. And due to high power consumption and higher cost, the popularity
of this method is going down.
Now-a-days LED display units are being used everywhere as a much better method of signage. They are
cheaper and much less power consuming. they can be used to display both static and dynamic messages
and other graphics. Some display units can be connected or cascaded together to create much larger
display units.Mono-color, bi-color and even RGB LED display units are being used today. The
information that are being displayed can be changed easily by connecting the display unit to a computer.
The objective of the project is to construct a SPI based 840 LED display capable of displaying static and
animated information.
2 Comparators
2 capture/compare/PWM functions
Its synchronous serial port can be configured as either Serial Peripheral Interface (SPI) or Inter-Integrated
Circuit (I2C) bus and a Universal Asynchronous Receiver Transmitter (USART).
MAX7219
The MAX7219 is serial input/output common-cathode display driver that can drive 7-segment displays of
up to 8 digits, bar-graph displays, or 64 individual LEDs. Included on-chip are a BCD code-B decoder,
multiplex scan circuitry, segment and digit drivers, and an 88 static RAM that stores each digit. One
external resistor is required to set the segment current for all LEDs.
It uses 4-wire serial interface for SPI communication. Individual digits may be addressed and updated
without rewriting the entire display. The devices include a shutdown mode, analog and digital brightness
control, a scan-limit register that allows the user to display from 1 to 8 digits, and a test mode that forces
all LEDs on. Pins DIG 0-DIG7 and SEG A-SEG G, DP are used to drive LEDs.
MAX232
MAX232 IC converts signals from an RS-232 serial port to signals suitable for use in TTL compatible
digital logic circuits. The MAX232 is a dual driver/receiver and typically converts the RX, TX, CTS and
RTS signals.
The drivers provide RS-232 voltage level outputs (approx. 7.5 V) from a single + 5 V supply via onchip charge pumps and external capacitors. This makes it useful for implementing RS-232 in devices that
otherwise do not need any voltages outside the 0 V to + 5 V range, as power supply design does not need
to be made more complicated just for driving the RS-232 in this case.
NL23881A
A column-cathode row-anode type 60 mmx60 m 88 LED matrix
Serial Clock(SCK)
RC0-LOAD
RC3-Serial Clock(SCK)
Another two pins of PORT C are used for RS-232 communication. They are
RB1 and RB2 of PORTB are used to get the button inputs of brightness and speed control.
Power Supply Unit
Supplies a smooth regulated 5 V to the microcontroller, RS-232 unit, Daughter card and to the LED panel
through Daughter card
RS-232 Communication Unit
Consist of MAX232 and serial port connector for serial communication with the computer.
Daughter Card
In the Daughter card circuit, 5 MAX7219 LED drivers are cascaded. LOAD pins of all the drivers are
connected together. DOUT of each IC is connected to the DIN of the next IC.DIN of the 1st IC is
connected to RC5 (SDO) pin of the microcontroller. Same clock pulse is given to all the drivers from
RC3 (SCK).
Brightness of the LEDs can be controlled either internally by the software or externally by connecting a
fixed or variable resistor between the V+ and ISET pins of MAX7219. The minimum value of this
resistor should be 9.53 k. In this project the brightness of the LEDs are controlled by the software. So a
10 k resister is connected to each IC. To reduce noise, 0.1 F capacitor is connected between V+ and
GND of each IC. There are two ground pins in MAX7219 ICs and both of them must be connected to
ground.
In this project, a single MAX7219 LED display driver controls 64 LEDs. It uses 16 pins for this task.
SEG A-SEG G and DP pins drive current to the display. When a segment driver is turned off, it is pulled
to GND and is at high-impedance state. DIG 0-DIG7 pins sink current from the display common cathode.
When turned off they are pulled to V+ and are at high-impedance state.
Display Panel
The display panel is a 840 red color LED matrix. The matrix was constructed by combining 5 columncathode row-anode type 60 mmx60 mm 88 LED matrices. Each matrix has 16 pins for rows 1-8 and
columns 1-8.The 5 88 segments are not interconnected and are controlled by the 5 MAX7219 ICs
individually. The matrix segments were not placed on the Daughter card were connected by 10 8-way
wire connectors. Even though the MAX7219 ICs have their SEG pins on one side and the DIG pins on
the other side of the IC the pins of the LED matrix segments were not in a proper order at all. So the
circuit design with LED matrix segments and the ICs on the same Daughter card ended up with large
number of jumpers. Even if a separate circuit is designed for the matrix segments still 10 wire connectors
are needed. The wire connectors fitted perfectly to the pins of the matrices. Thus connecting matrices to
Daughter card directly with wire connectors seemed to be a better option.
Control registers consist of decode mode, display intensity, scan limit, shut down and display
test registers and are set prior to display use.
Digit registers consist of 8 registers. They can be directly addressed updated individually.
Apart from the above two types, there is a another register called No-Op register. This register is used to
write data to a specific IC, when several MAX7219s are cascaded.
SPI Communication
Data is transmitted to LED drivers via SPI Master mode of the microcontroller. In Master mode the clock
is provided by the microcontroller. In the circuit 4 MHz crystal is used and the clock speed is at 1 MHz.
The 2 control registers SSPSTAT and SSPCON1 are set to accomplish the required data communication.
In this project, the following register bits were set
SPI mode transmits 8 bits of data serially. MAX7219 requires 16-bit data packets to function. Thus the 16
bits of data is transmitted as 2 8-bit data packets. The LOAD is cleared before the transmission of the 1st
8-bit data packet and setright after the 2nd 8-bit data packet is transmitted. There is no delay between the
1st and the 2nd data packets. So MAX7219 receives 16-bit data packets.
Software
The LED display basically displays text. Each character is defined by 8 hexadecimal numbers. Characters
are defined in a 88 matrix with 1st and 8th columns as 0s.then the spacing between characters are
automatically set. the character definitions are stored in an array.
Two functions were written to pass data to LED drivers.
The first function passes 16-bit data packets. This function is used to write to control registers.5 16-bit
data packets are passed to the control registers and to write same control data on all 5 ICs, these data
packets are followed by 5 No-Op codes.
The second function passes 80-bit data packets to the LED drivers. This function is used to write to a
specific digit register in a specific IC. The 80 bits consist of 4 No-Op codes and 1 16-bit data packet
which needs to written. By changing the sequence of the 4 No-Op codes and the data packet, the data can
be written in any one of the 5 ICs.
Brightness of the LEDs of the display and the speed of the animations are set at initial power up by two
functions. A delay function is used to control the speed.
Different functions are written to animate different scrolling, display and transition patterns.
The sequence of the program is as follows.
1.
2.
3.
4.
Results
The LED display unit worked well in displaying preprogrammed text based massages in preprogrammed
characters. All the programmed animations worked well. The SPI based LED display was programmed to
display various types of animations.
Static
Horizontal scrolling
Vertical scrolling
Blinking
Display fill
Display clear
The display was able to display all the animations without any errors or delays. Any one or more LEDs in
the panel could be lit up at any given time. The brightness and the speed of the display could be adjusted
by the two external buttons. The text on the display was visible in well-lit indoors even with minimum
brightness.
RS-232 communication between the device and the computer was not successful due to a
hardware failure.
Conclusions
Some LED matrix displays are based on cascaded counters. To transfer data to the display they require
output pins equal to the number of rows of the matrix. In that method only one column is lit at a time and
all the columns needs to scanned before updating the display. This leads to flickers on display Thus long
display panels cannot be constructed successfully with this method. And the design is always limited by
the number of outputs pins of the microcontroller. And also external current drivers and transistor arrays
are required to drive LEDs.
The method implemented in this project requires only 3 pins to communicate with a LED matrix of any
height or width. Each 88 LED segment controlled and scanned separately. Thus any column of any 88
matrix can be updated separately without updating the whole matrix. Data can be transferred to the matrix
at a maximum speed of 10 MHz. So even large LED matrices can be updated by a single microcontroller
without any flicker. MAX 7219s are specifically designed to drive LEDs. So the external current drivers
or transistors are not required to drive the LEDs.
Limitations
Brightness and speed could only be adjusted at the start up. They cannot be adjusted during the
display. The program needs to be reset in order to adjust the speed and the brightness again.
Clearing the LED matrix before each frame update ended up giving a slight flicker due to low
scan rate of the LED drivers.
The RS-232 unit of the motherboard did not work successfully due to a hardware failure. Serial
communication between microcontroller and computer could not be achieved. Thus the
microcontroller could not be programmed serially by the motherboard itself.
Maximum data transfer speed of 10 MHz between microcontroller and MAX 7219s could not be
achieved due to the use of external 4 MHz crystal oscillator.
Using interrupt statements to control brightness and speed and any time
Increasing row and column length of the matrix to display larger and detailed images and
information
defined
Developing a graphical user interface to manipulate the display by a computer using serial port
or USB port.
Constructing the LED matrix using RGB LEDs to display colored images
Constructing a separate hardware circuit to each 88 LED matrix with a MAX7219 so they can
be used as building blocks to construct larger LED matrices
References
7219_1.C
840 LED display
MAX232
PIC16F876A & MAX7219 For 88 LED Display
PIC16F877A
PIC16F87XA Data Sheet
Serially Interfaced, 8-Digit, LED Display Drivers
Cascading Max7219
Matrix & Sprite Libraries
Component
Quantity
PIC16F877A
40-pin IC base
MAX232
16-pin IC base
LM7805
22 pF capacitor
0.1 F capacitor
1 F electrolyte
220 F electrolyte
micro switch
Push buttons
1-way switch
LED Red
LED Green
Component
Quantity
MAX7219
10
10 k resistor
0.1 F capacitor