Chapter I overview

LED dot matrix display screen extracts the Chinese character pattern to be displayed through PC, sends it to MCU, and then displays it on the dot matrix screen. It is mainly suitable for indoor and outdoor Chinese character display.

Chapter II hardware design

2.1 introduction to main devices

The LED dot matrix display screen is composed of 20 8 * 8 LED dot matrix blocks to form a 16 * 80 rectangular dot matrix, which is based on ATMEL’s AT89S52 single chip microcomputerAs the control core. Other main hardware of the display screen are: ① 8-bit shift register 74HC595 with latch output as column line drive input of LED; ② The 38 decoder 74LS138 is used as the decoding selection of LED line; ③ The triode c9012 is connected to the sixteen outputs of two 38 decoders as a switch to drive the line of LED.

2.2 detailed connection description of main devices

Control design of LED dot matrix display screen by AT89S52 single chip microcomputer

The pins connected to related devices of ATMEL’s AT89S52 chip are as follows: p00-p03 is connected to input ports a, B, C, ~ G2A of 3-8 decoder

Control design of LED dot matrix display screen by AT89S52 single chip microcomputer

P20-p23 connect input ports RCK, Si, SCK and SCLR of 74HC595

The 16 output terminals of the 38 decoder 74LS138 are connected to the base B of the triode of 16 c9012, the emitter e is connected to the 16 line control terminals, and the collector C is connected to GND.

The 80 column data line driver of the dot matrix is composed of 10 74HC595 cascades, and the q’h pin of the previous 74HC595 is connected

For the Si pin of the next chip, the RCK, SCK and SCLR of each chip are connected in parallel.

2.3 LED dot matrix block

The 8 * 8 LED dot matrix is a monochrome row common Yang module. The working voltage of a single point is forward (VF) = 1.8 V and forward current (if) = 8-10 ma. When the device is statically lit (64 points are fully lit), the total current is 640ma, the total voltage is 1.8 V, and the total power is 1.15w. Depending on the scanning frequency (1 / 8 or 1 / 16 second), the single point instantaneous current can reach 80-160 ma. 16 * 16 dot matrix static 16 * 16 * 10mA, dynamic single point current 80-160ma.

Wiring mode:

When a row line is high and a column line is low, the intersection of rows and columns will be lit;

When a column line is high, the intersection point of its rows and columns is dark;

When a line is set low, the points corresponding to this line are all dark regardless of the column line.

Control design of LED dot matrix display screen by AT89S52 single chip microcomputer

Column line: 13-20 control the column connection low level of the dot matrix

Row line: 1-4 21-24 control the row connection high level of the dot matrix

2.4 AT89S52

Control design of LED dot matrix display screen by AT89S52 single chip microcomputer

Control design of LED dot matrix display screen by AT89S52 single chip microcomputer

(1) P0.0 [pin 39], P0.1 [pin 38], P0.2 [pin 37], p0.3 [pin 36] are connected with a, B, C of two 3-8 decoders, ~ G2A of the first chip and G1 of the second chip to select the line of LED

(2) P2.0 [pin 21]: connected to RCK pin of 74HC595.

P2.1 [22 pin]: connected to SCK pin of 74HC595.

P2.2 [23 pin]: connected to Si pin of 74HC595.

P2.3 [24 pin]: connected to SCLR pin of 74HC595.

(3) Other

VCC [40 pin]: connected to power supply

EA / VPP [pin 31]: connected to power supply

Rst [9 pin]: reset pin. Connect GND through 10K resistor and VCC through 10uF capacitor C3; The reset button is connected to both ends of capacitor C2.

2.5 shift register 74HC595

74HC595 is an 8-bit shift register with latch output. Its pin is shown in the figure below, where Si is the input of serial data;

VCC and GND are power supply and ground respectively; RCK is the input clock of the storage register, SCK is the input clock of the shift register, SCLR is the input clear of the shift register, q’h is the output of serial input data, G is the output enable control of input data, and QA ~ QH is the parallel output of serial input data. The data input from the Si port is moving

Control design of LED dot matrix display screen by AT89S52 single chip microcomputer

Under the action of the rising edge of SCK pin of bit register, it is input into 74HC595. Under the action of the rising edge of RCK pin, the input data is locked in 74HC595. When G is low level, the data is output in parallel. SCLR is the input clear end of the shift register.

Connection between 74HC595 and AT89S52: Si [14 pins], SCK [11 pins], RCK [12 pins] and SCLR [10 pins] are connected to p2.2 [23 pins], p2.1 [22 pins], p2.0 [21 pins] and p2.3 [24 pins] of AT89S52 respectively.

Other pin connection: OE [13 pin] is grounded to make it output all the time;

Q’h [pin 9] is the Si pin connecting the next 74HC595; QA, QB and QH are respectively connected to the column pins of columns 1 to 8 of the LED dot matrix.

2.6 38 decoder 74LS138

Control design of LED dot matrix display screen by AT89S52 single chip microcomputer

The figure shows the connection diagram of expanding the two 74LS138 decoders into 4-wire-16-wire decoders. Its wiring features are: connect the lower three bits C, B and a of the four input signals ~ G2A, C, B and a to the address input terminals of the two chips at the same time. The highest bit ~g2a of the input signal is connected to the enable end of the two chips, so that the two chips can not work at the same time~ G2A, C, B and a are used as address input variables to form binary codes, and Y0 ~ Y7 and Y0 ~ Y7 are used as input signals. Each output represents the meaning of a binary code, that is, it can realize the function of 4-wire-16-wire decoder.

Chapter III software design

3.1 program design of single chip microcomputer

In the LED dot matrix display system, single chip microcomputer is mainly responsible for three main functions: data receiving, storage and scanning display.

/***************************************************************************************************

* Name: khldragon

* Date: 09/12/2009

* Description: This program controls 16*80LED and implements dynamic scan.

****************************************************************************************************/

#include

#include

#Define conio P0 / / line selection signal

#Define numofwords (6) / / number of words displayed

#Define speed (30) / / the larger the scanning cycle, the slower the scanning;

#Define maxwords (5) / / the maximum fixed number of words displayed on the screen

#Define blank (4) / / fill in blanks

#Define maxrow (16) / / maximum number of rows

staTIc sbit OE = P0^4; // Control 74LS138, active at low level

staTIc sbit RCK = P2^0; // Data output at rising edge

staTIc sbit SCK = P2^1; // Data shift on rising edge

staTIc sbit SI = P2^2; // 74HC595 serial input

static sbit SCLK = P2^3; // The low level shift register is cleared, usually connected to VCC

static void send_ in(unsigned char Data); // Serial data input

static void send_ out(void); // Parallel data output

static unsigned int row = 0; // Line selection signal

static int j = 0;

static int k = 0;

static int m = 0;

static int s = 0; // Match speed

static int count = 0; // The maximum number of words Max is reached when it is 5

const static unsigned char code zimo[][32]={

{0x20,0x08,0x13,0xFC,0x12,0x08,0x02,0x08,0xFE,0x08,0x0A,0x08,0x12,0x08,0x3B,0xF8,

0x56, 0xa8, 0x90, 0xa0, 0x10, 0xa0, 0X11, 0x20, 0X11, 0x22, 0x12, 0x22, 0x14, 0x1E, 0x18, 0x00}, / / good luck

{0x00,0x80,0x20,0x80,0x20,0x80,0x20,0x80,0x20,0x88,0x24,0x98,0x3E,0xA0,0x20,0xC0,

0x20, 0x80, 0x20, 0x80, 0x20, 0x80, 0x20, 0x82, 0x26, 0x82, 0x38, 0x82, 0x60, 0x7e, 0x00, 0x00}, / / ratio

{0x01,0x00,0x7F,0xFE,0x44,0x42,0x9F,0xF4,0x04,0x40,0x1F,0xF0,0x04,0x40,0x7F,0xFC,

0x08, 0x20, 0x1f, 0xf0, 0x28, 0x2e, 0xc9, 0x24, 0x09, 0x20, 0x01, 0x00, 0x06, 0xc0, 0x18, 0x30}, / / match

{0x00,0x80,0x00,0xA0,0x00,0x90,0x3F,0xFC,0x20,0x80,0x20,0x80,0x20,0x84,0x3E,0x44,

0x22, 0x48, 0x22, 0x48, 0x22, 0x30, 0x2a, 0x20, 0x24, 0x62, 0x40, 0x92, 0x81, 0x0a, 0x00, 0x06}, / / assembly

{0x00,0x80,0x00,0x80,0x08,0x80,0xFC,0x80,0x10,0x84,0x17,0xFE,0x10,0x84,0x10,0x84,

0x10, 0x84, 0x10, 0x84, 0x1d, 0x04, 0xf1, 0x04, 0x41, 0x04, 0x02, 0x44, 0x04, 0x28, 0x08, 0x10}, / / work

{0x00,0x00,0x01,0x80,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x03,0xC0,0x01,0x80,

0x01,0x80,0x01,0x80,0x00,0x00,0x01,0x80,0x03,0xC0,0x01,0x80,0x00,0x00,0x00,0x00},//!

};

void main()

{

//Initialization pin

CONIO = 0X00;

P2 = 0X08;

/**********************************Dynamic scanning left shift display unlimited words***************************************/

while(1)

{

for(k = 0; k 《 NUMOFWORDS; k++)

{/ / scan numofwrods times

for(s = 0; s 《 SPEED; s++)

{

for(row = 0; row 《 MAXROW; row++)

{

count = 0;

//Send the word to be displayed to the Si terminal of 74HC595, that is, P2 ^ 2 pin of MCU

for(j = k; j 》= 0; j–)

{

count++;

if(count 》 MAXWORDS)

break;

send_ in(zimo[j][2*row+1]);

send_ in(zimo[j][2*row]);

}

//Fill in blanks

for(m = BLANK-k; m 》 0; m–)

{

send_ in(0);

send_ in(0);

}

send_ out();

CONIO=row;

}

}

}

//The following program logic is the same as above, but the position is changed

for(k = 1; k 《= MAXWORDS; k++)

{

for(s = 0; s 《 SPEED; s++)

{

for(row = 0; row 《 MAXROW; row++)

{

for(m = k; m 》 0; m–)

{

send_ in(0);

send_ in(0);

}

for(j = 1; j 《= MAXWORDS – k; j++)

{

send_ in(zimo[NUMOFWORDS-j][2*row+1]);

send_ in(zimo[NUMOFWORDS-j][2*row]);

}

send_ out();

CONIO=row;

}

}

}

}

}

/*****************************************************************

**Function name: void send_ in(unsigned char data)

**Input: unsigned char data

**Output: void

**Function Description: send data to 74HC595

**Global variable: SCK Si

**Calling module: Main ()

**Author: khldragon

**Date: 09 / 12 / 2009

**Version 1.0

****************************************************************/

void send_ in(unsigned char data)

{

unsigned char i;

for(i = 0; i 《 8; i++)

{/ / cycle 8 times and just move 8 bits

SCK = 0; // First set the shift register control pin to low

SI = Data & 0x01; // Get the lowest bit of data, form: little endian

Data 》》= 1; // Move the next highest bit of data to the highest bit

SCK = 1; // Set it high again to generate the rising edge of the shift clock. When the rising edge, the data of the data register is shifted

_ nop_ ();

}

}

/*****************************************************************

**Function name: void send_ out(void)

**Input: void

**Output: void

**Function Description: send data to LED

**Global variables: RCK

**Calling module: Main ()

**Author: khldragon

**Date: 09 / 12 / 2009

**Version 1.0

****************************************************************/

void send_ out(void)

{

RCK = 0; // First set the storage register pin to low

_ nop_ ();

_ nop_ ();

RCK = 1; // Then set it high to generate the rising edge of the shift clock. When the rising edge, the data of the shift register enters the data storage register to update the display data.

_ nop_ ();

_ nop_ ();

RCK = 0; // First set the storage register pin to low

}

Leave a Reply

Your email address will not be published. Required fields are marked *