51 single chip microcomputer [five] LED dot matrix screen

Publisher:以泉换泉Latest update time:2020-03-13 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

I will not go into details about the concepts of display resolution, pixels, and clarity.


Let's talk about the unfamiliar concept of pitch: it refers to the distance between the centers of two pixels, usually in millimeters by default. For example, p10 refers to an LED dot matrix with a pitch of 10 mm.

LED P00-P07 is directly connected to the processor, but because the processor has limited pins, the following 74HC595 is needed (the processor uses 3 pins to generate 8 parallel signals through this chip, which is equivalent to using 8 pins)

If J13 is jumpered with OE and GND, HC595 will not work. If there is no voltage, jumpered with OE and VCC, it can work.


74HC595 is a shift register. 74HC595 converts serial signals into parallel signals. P34 is the processor input serial signal, P36 is the serial clock, and P35 is the working clock. Then this chip processes and generates 8 parallel signals connected to D0-D7 of the LED matrix. 


Here this chip can also control a row of LEDs by connecting the J14 jumper cap in the figure. One end of the LED is high voltage and the other end is 8 serial high and low voltages output by HC595 to light up the LED.


void Hc595SendByte(u8 dat)

{

u8 i = 0, j = 0;

 

SCK = 0; // Set SCK to the initial state

RCK = 0; // Set RCK to the initial state

 

for (i=0; i<8; i++) //Use the for loop to send the digital signal 8 times, which is a serial signal

{

SER = dat >> 7;

dat <<= 1;

 

SCK = 1;

j++; // Delay code, equivalent to nop instruction

j++; // Delay code, equivalent to nop instruction

SCK = 0;

}

 

RCK = 1;

j++; // Delay code, equivalent to nop instruction

j++; // Delay code, equivalent to nop instruction

}

 

The principle of LED dot matrix display is similar to the dynamic display of digital tube


First, select each LED pixel to be lit and then refresh it repeatedly.


Link: https://pan.baidu.com/s/1-RGR0v9WUH7LWmOaUTpSbQ 

Extraction code: pmw2 


This is the font extraction software, which helps you select the LED tubes that need to be lit

Note: You need to run it as an administrator 

                  The font is generated by the CD: tool software/88 font extraction software/LEDDOT V0.2.exe

                  Note that in the menu bar settings of the mold taking software, the settings are:

                  Font display mode: single line

                  Font extraction method: column by column

                  Font extraction format: C51 format


void main(void)

{

MatrixDisplay(gZhu);

}

void MatrixDisplay(u8 *zimo)

{

u8 i = 0;

 

while (1)

{

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

{

MATRIX_PORT = gLineCode[i]; // bit selection

Hc595SendByte(zimo[i]); // Send segment selection data

Hc595SendByte(0x00); // Blanking

}

}

}


 


void Hc595SendByte(u8 dat)

{

u8 i = 0, j = 0;

 

SCK = 0; // Set SCK to the initial state

RCK = 0; // Set RCK to the initial state

 

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

{

SER = dat & (0x01);

dat >>= 1;

 

SCK = 1;

j++; // Delay code, equivalent to nop instruction

j++; // Delay code, equivalent to nop instruction

SCK = 0;

}

 

RCK = 1;

j++; // Delay code, equivalent to nop instruction

j++; // Delay code, equivalent to nop instruction

}

 

/*

// Since the module software can only select horizontal and vertical directions, but cannot select vertically from top to bottom or from bottom to top

// The actual test mode of the modulus software is suitable for sending LSB first instead of MSB

void Hc595SendByte(u8 dat)

{

u8 i = 0, j = 0;

SCK = 0; // Set SCK to the initial state

RCK = 0; // Set RCK to the initial state

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

{

SER = dat >> 7;

dat <<= 1;

SCK = 1;

j++; // Delay code, equivalent to nop instruction

j++; // Delay code, equivalent to nop instruction

SCK = 0;

}

The order of sending serial codes here is different from the previous one. This requires actual testing because this order may cause the actual words on the LED to be reversed.


**********************************************************************

* Header file contains

**********************************************************************

*/

#include

#include

/*

**********************************************************************

* Local macro definition

**********************************************************************

*/

typedef unsigned char u8; // Renaming type u8 simplifies code writing

typedef unsigned int u16;

 

#define MATRIX_PORT P0 // Dot matrix LED negative port

 

/*

**********************************************************************

* Local global variables

**********************************************************************

*/

sbit SCK = P3^6; // SCK rising edge shift

sbit RCK = P3^5; // RCK rising edge serial output register latch

sbit SER = P3^4; // SER pin sends byte data in

 

// Select the value of each element in the array. Select one column

u8 gLineCode[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};  

 

/* Font

 * The font is generated by the CD: tool software/88 font extraction software/LEDDOT V0.2.exe

 * Note that in the menu bar settings of the mold taking software, the settings are:

 * Font display mode: single line

 * Font extraction method: column by column

 * Font extraction format: C51 format

 */

 

u8 gZhu[] = {0x73,0xD6,0x58,0xFF,0x58,0x54,0x52,0x12}; // Chinese character Zhu

u8 gSi[] = {0x0,0x4,0x1C,0x24,0x7E,0x4,0x0,0x0}; // number 4

u8 gK[] = {0x0,0x0,0x7E,0x38,0x66,0x0,0x0,0x0}; // Font K

 

/*

**********************************************************************

* Function prototype declaration

**********************************************************************

*/

void Hc595SendByte(u8 dat);

void MatrixDisplay(u8 *zimo);

 

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

* Function name: main

* Function: Main function

* Parameter list: None

* Function output: None

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

void main(void)

{

MatrixDisplay(gZhu);

}

 

 

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

* Function name: MatrixDisplay

* Function: Refresh the font to dot matrix in a loop

* Parameter list: zimo - array of fonts to be displayed

* Function output: None

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

void MatrixDisplay(u8 *zimo)

{

u8 i = 0;

 

while (1)

{

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

{

MATRIX_PORT = gLineCode[i]; // bit selection

Hc595SendByte(zimo[i]); // Send segment selection data

Hc595SendByte(0x00); // Blanking

}

}

}

 

 

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

* Function name: Hc595SendByte

* Function: Send a byte through 74HC595 serial shift

* Parameter list: dat - byte data to be sent

* Function output: None

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

void Hc595SendByte(u8 dat)

{

u8 i = 0, j = 0;

 

SCK = 0; // Set SCK to the initial state

RCK = 0; // Set RCK to the initial state

 

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

{

SER = dat & (0x01);

dat >>= 1;

 

SCK = 1;

j++; // Delay code, equivalent to nop instruction

j++; // Delay code, equivalent to nop instruction

SCK = 0;

}

 

RCK = 1;

j++; // Delay code, equivalent to nop instruction

j++; // Delay code, equivalent to nop instruction

}

 

/*

// Since the module software can only select horizontal and vertical directions, but cannot select vertically from top to bottom or from bottom to top

// The actual test mode of the modulus software is suitable for sending LSB first instead of MSB

void Hc595SendByte(u8 dat)

{

u8 i = 0, j = 0;

SCK = 0; // Set SCK to the initial state

RCK = 0; // Set RCK to the initial state

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

{

SER = dat >> 7;

dat <<= 1;

SCK = 1;

j++; // Delay code, equivalent to nop instruction

j++; // Delay code, equivalent to nop instruction

SCK = 0;

}

RCK = 1;

j++; // Delay code, equivalent to nop instruction

j++; // Delay code, equivalent to nop instruction

}

Reference address:51 single chip microcomputer [five] LED dot matrix screen

Previous article:The 8x8 dot matrix of the single chip microcomputer allows the number 0 to be displayed in a cycle from right to left
Next article:LED dot matrix of single chip microcomputer

Recommended ReadingLatest update time:2024-11-16 14:52

DIY design of AC LED energy-saving time-delay lamp
Plug a time-delay switch into the socket beside the bed in the bedroom . Press the switch before going to bed and the light will turn on. When you are ready to go to bed, the light will automatically turn off, which is also convenient for going to the bathroom at night. If a white high- brightness
[Power Management]
DIY design of AC LED energy-saving time-delay lamp
Open circuit protection scheme for series-connected LED lamp beads in automotive lighting
There are many types of LED automotive lighting , which are mainly divided into two categories: interior lighting and exterior lighting. Before introducing the solution, we need to clearly know what automotive lighting is. The subdivisions are as follows: 1. Internal lighting: backlight, dimming, integrated HMI
[Automotive Electronics]
Open circuit protection scheme for series-connected LED lamp beads in automotive lighting
LED office lighting design techniques
Some people praise office space as "both soft and hard". Looking at the designs of ancient and modern times, both at home and abroad - interior design (office space), its essential flow is the combination of points, lines and surfaces. Since the earliest architectural design, architectural design has always been the s
[Power Management]
A very easily overlooked advantage of LED lighting
While everyone is paying attention to the advantages of LED light sources , such as high light efficiency and energy saving, a very important advantage of LED lighting , mercury-free, is often overlooked. We know that mercury is an extremely toxic substance, but almost most of the currently us
[Power Management]
LED driver power supply production process analysis
Design and manufacturing method of LED fluorescent lamp power supply I am engaged in switching power supply. I used to make adapters, chargers, and iron-shell switching power supply. Later, I made LED power supply. At first, I made some 1W and 3W high-power LED drivers , but later I made less.
[Power Management]
LED display failure analysis and treatment methods
As a backbone enterprise in the LED display industry, Tongpu Technology has formed its own technical standards and its own problem-solving methods in the course of many years of development. However, in the large family of LED display companies, most companies encounter different problems. The following is a fault anal
[Power Management]
"Eight Questions and Eight Answers" Comprehensively Decrypt LED Chip Knowledge
  1. What is the manufacturing process of LED chips ?    LED chip manufacturing is mainly to manufacture effective and reliable low-ohm contact electrodes, and to meet the minimum voltage drop between contactable materials and provide pressure pads for welding wires, while emitting as much light as possible. The coat
[Power Management]
Switching Regulator for Effective White LED Current Control
A few years ago, manufacturers also set the maximum forward current rating of their white LEDs, rather than dim LEDs, at 20 mA. Today's white LEDs can provide higher brightness and therefore must operate at higher bias currents. Maintaining control of the LED bias point while operating at high currents close to the LED
[Power Management]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号