The 51 MCU 16X32LED dot matrix display screen consists of a MCU minimum system, a row drive circuit 74HC154, and a column drive circuit 74HC595, which can display Chinese characters and numbers. The circuit is simple. 20 Chinese characters are used as display examples in the program. The data includes the 51 MCU C language source program and PROTEUS7.8 simulation source file. The module software and module instruction document are attached to facilitate you to change the display content. The display movement speed can be set in the program.
#include
#define FOSC 12 //Define crystal frequency
#define INIT_TH0 0x3C //Initial value of timer T0
#define INIT_TL0 0xB0
#define TMOD_T00 0x00 //Define T0 as mode 0, GATE=0, C/T=0, 13-bit counter
#define TMOD_T01 0x01 //Define T0 as mode 1, GATE=0, C/T=0, 16-bit counter
#define TMOD_T02 0x02 //Define T0 as mode 2, GATE=0, C/T=0, automatically load 8-bit counter
#define TMOD_T03 0x03 //Define T0 as mode 3, GATE=0, C/T=0, timer 0 is divided into two 8-bit counters, timer 1 stops counting
/*Shortcut definition*/
#define uchar unsigned char
#define uint unsigned int
/************Bit definition****************/
sbit STTP = P2^7;
/************Function declaration****************/
void delay(uint c); //Delay function
void out_rxd(uchar *d); //Chinese character output
/************Chinese character dot matrix****************/
char code hanzi[32][32]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //Display a blank screen. If there is only one word or all the words are moved out, a blank screen must be set
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, //Display a blank screen. If there is only one word or all the words are removed, a blank screen must be set.
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- Text: Base --*/
/*-- Songti 12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x00,0x88,0x20,0x88,0x20,0x91,0x20,0xA1,0xFF,0xC9,0x2A,0x89,0x2A,0x89,0x2A,0xBF,
0x2A,0x89,0x2A,0x89,0xFF,0xC9,0x20,0xA1,0x20,0x91,0x20,0x88,0x00,0x88,0x00,0x00,
/*-- Text: Yu --*/
/*-- Songti 12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x02,0x00,0x02,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x42,0x02,0x42,0x01,0x7F,0xFE,
0x42,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,
/*-- Text: 5 --*/
/*-- Songti 12; The corresponding dot matrix under this font is: width x height = 8x16 --*/
0x00,0x00,0x1F,0x98,0x10,0x84,0x11,0x04,0x11,0x04,0x10,0x88,0x10,0x70,0x00,0x00,
/*-- Text: 1 --*/
/*-- Songti12; The corresponding dot matrix under this font is: width x height = 8x16 --*/
0x00,0x00,0x08,0x04,0x08,0x04,0x1F,0xFC,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
/*-- Text: Single --*/
/*-- Songti12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x00,0x08,0x00,0x08,0x1F,0xC8,0x92,0x48,0x52,0x48,0x32,0x48,0x12,0x48,0x1F,0xFF,
0x12,0x48,0x32,0x48,0x52,0x48,0x92,0x48,0x1F,0xC8,0x00,0x08,0x00,0x08,0x00,0x00,
/*-- Text: 片 --*/
/*-- Songti 12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x00,0x00,0x00,0x01,0x00,0x06,0x7F,0xF8,0x04,0x40,0x04,0x40,0x04,0x40,0x04,0x40,
0x04,0x40,0xFC,0x40,0x04,0x7F,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- Text: 机 --*/
/*-- 宋体12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x08,0x20,0x08,0xC0,0x0B,0x00,0xFF,0xFF,0x09,0x00,0x08,0xC1,0x00,0x06,0x7F,0xF8,
0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0xFC,0x00,0x02,0x00,0x02,0x00,0x1E,0x00,0x00,
/*-- Text: --*/
/*-- Songti12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x00,0x00,0x1F,0xFE,0x30,0x84,0xD0,0x84,0x10,0x84,0x10,0x84,0x1F,0xFE,0x02,0x00,
0x0C,0x00,0xF1,0x00,0x10,0xC2,0x10,0x01,0x10,0x02,0x1F,0xFC,0x00,0x00,0x00,0x00,0x00,
/*-- Text: 1 --*/
/*-- Songti12; The corresponding dot matrix under this font is: width x height = 8x16 --*/
0x00,0x00,0x08,0x04,0x08,0x04,0x1F,0xFC,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,
/*-- Text: 6 --*/
/*-- Songti12; The corresponding dot matrix under this font is: width x height = 8x16 --*/
0x00,0x00,0x07,0xF0,0x08,0x88,0x11,0x04,0x11,0x04,0x18,0x88,0x00,0x70,0x00,0x00,
/*-- Text: × --*/
/*-- Songti12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x08,0x20,0x04,0x40,0x02,0x80,
0x01,0x00,0x02,0x80,0x04,0x40,0x08,0x20,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*-- Text: 3 --*/
/*-- Songti12; The corresponding dot matrix under this font is: width x height = 8x16 --*/
0x00,0x00,0x0C,0x18,0x10,0x04,0x11,0x04,0x11,0x04,0x12,0x88,0x0C,0x70,0x00,0x00,
/*-- Text: 2 --*/
/*-- Songti12; The corresponding dot matrix under this font is: width x height = 8x16 --*/
0x00,0x00,0x0E,0x0C,0x10,0x14,0x10,0x24,0x10,0x44,0x11,0x84,0x0E,0x0C,0x00,0x00,
/*-- Text: Dot --*/
/*-- Songti 12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x00,0x01,0x00,0x02,0x03,0xEC,0x02,0x20,0x02,0x20,0x02,0x28,0xFE,0x26,0x12,0x20,
0x12,0x28,0x12,0x26,0x12,0x20,0x13,0xE0,0x10,0x08,0x10,0x07,0x00,0x00,0x00,0x00,
/*-- Text: Matrix --*/
/*-- Songti 12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x00,0x00,0x7F,0xFF,0x40,0x10,0x44,0x08,0x5B,0x10,0x60,0xE0,0x10,0x10,0x13,0x10,
0x1D,0x10,0xF1,0x10,0x17,0xFF,0x11,0x10,0x11,0x10,0x11,0x10,0x10,0x10,0x00,0x00,
/*-- Text: Display --*/
/*-- Songti 12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x00,0x02,0x00,0x42,0x00,0x22,0x7F,0x1A,0x49,0x02,0x49,0xFE,0x49,0x02,0x49,0x02,
0x49,0x02,0x49,0xFE,0x49,0x02,0x7F,0x0A,0x00,0x12,0x00,0x62,0x00,0x02,0x00,0x00,
/*-- Text: 示 --*/
/*-- 宋体12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x02,0x04,0x02,0x08,0x42,0x10,0x42,0x60,0x42,0x00,0x42,0x02,0x42,0x01,0x43,0xFE,
0x42,0x00,0x42,0x00,0x42,0x00,0x42,0x40,0x42,0x20,0x02,0x10,0x02,0x0C,0x00,0x00,
/*-- Text: Screen --*/
/*-- Songti 12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x00,0x02,0x00,0x0C,0x7F,0xF0,0x48,0x20,0x49,0x21,0x4D,0x26,0x4B,0xF8,0x49,0x20,
0x49,0x20,0x49,0x20,0x4B,0xFF,0x4D,0x20,0x79,0x20,0x00,0x20,0x00,0x00,0x00,0x00,
/*-- Text: 程 --*/
/*-- 宋体12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x24,0x10,0x24,0x60,0x25,0x80,0x7F,0xFF,0xC4,0x80,0x44,0x60,0x00,0x02,0x7C,0x92,
0x44,0x92,0x44,0x92,0x44,0xFE,0x44,0x92,0x44,0x92,0x7C,0x92,0x00,0x82,0x00,0x00,
/*-- Text: 序 --*/
/*-- 宋体12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x00,0x02,0x00,0x0C,0x3F,0xF0,0x20,0x00,0x20,0x80,0x20,0x80,0x28,0x80,0xA8,0x82,
0x6A,0x81,0x29,0xFE,0x2A,0x80,0x2C,0x80,0x28,0x80,0x20,0xA0,0x20,0xC0,0x00,0x00,
/*-- Text: Set --*/
/*-- Songti 12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x02,0x00,0x02,0x00,0x42,0x00,0x33,0xFC,0x00,0x09,0x02,0x11,0x05,0x02,0x79,0xC2,
0x41,0x34,0x41,0x08,0x41,0x14,0x79,0x62,0x05,0x82,0x04,0x01,0x04,0x01,0x00,0x00,
/*-- Text: 计 --*/
/*-- 宋体12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x02,0x00,0x02,0x00,0x42,0x00,0x33,0xFE,0x00,0x04,0x02,0x08,0x02,0x00,0x02,0x00,
0x02,0x00,0xFF,0xFF,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,
/*-- Text: and --*/
/*-- Songti 12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x00,0x10,0x00,0x10,0x07,0x10,0xF9,0x10,0x11,0x10,0x11,0x10,0x11,0x10,0x11,0x10,
0x11,0x10,0x11,0x12,0x11,0x01,0x11,0x02,0x11,0xFC,0x10,0x00,0x00,0x00,0x00,0x00,
/*-- Text: Imitation --*/
/*-- Songti 12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x00,0x80,0x01,0x00,0x06,0x00,0x1F,0xFF,0xE0,0x01,0x10,0x02,0x10,0x0C,0x1F,0xF0,
0x91,0x00,0x71,0x02,0x11,0x01,0x11,0x02,0x11,0xFC,0x10,0x00,0x10,0x00,0x00,0x00,
/*-- Text: True --*/
/*-- Songti 12; The corresponding dot matrix under this font is: width x height = 16x16 --*/
0x00,0x08,0x20,0x08,0x20,0x09,0x2F,0xFA,0x2A,0xAC,0x2A,0xA8,0x2A,0xA8,0xFA,0xA8, 0x2A,0xA8,0x2A,
0xA8,0x2A,0xAC,0x2F,0xFA,0x20,0x09,0x20,0x08,0x00,0x08,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //Display a blank screen. If there is only one word or all the words are moved out, a blank screen must be set
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
};
/************Main function***************/
void main()
{
uchar i,j,k; //i: display cycle of each word; j: display code of each word divided by 2; k: refresh times of each column
uint b=0; //Display offset control. char type can only display up to 14 Chinese characters + one blank character
uchar a; //Control movement interval time
SCON = 0x00;
while(1)
{
j=0;
if(a>6) //Move interval time; value 0-20
{
a=0;
b+=2;
if(b>=700) //Display to the last word, turn back to display, judgment value = number of words*32
{
b=0;
}
}
for(i=0;i<16;i++)
{
P1=i;
for(k=0;k<1;k++)
{
STTP = 0;
out_rxd(&hanzi[3][j+b+1]);
out_rxd(&hanzi[3][j+b]);
out_rxd(&hanzi[2][j+b+1]);
out_rxd(&hanzi[2][j+b]);
out_rxd(&hanzi[1][j+b+1]);
out_rxd(&hanzi[1][j+b]);
out_rxd(&hanzi[0][j+b+1]);
out_rxd(&hanzi[0][j+b]);
STTP = 1;
delay(15);
}
j=j+2;
}
a++;
}
}
/************Sub-function**************/
void delay(uint c)
{
int i,j;
for(i=0;i
;
........................................................................
Previous article:Microcontroller elevator controller code
Next article:Share the PWM wave program of stc15 microcontroller
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- New hot spot in automobiles: In-depth analysis of T-BOX system solutions
- What are the differences between 4G and 5G networks?
- Altera-FPGA programming steps and precautions
- MSP432UART Test
- ESP32, only one timer is turned on, the power consumption is very high, what should I do
- [TI recommended course] #Power Tips — Power management design tips series#
- STM32 allows pyb, uos, utime, machine and onewire modules to be configurable
- What do you plan to do during the National Day holiday?
- FAQ Sharing: Frequently Asked Questions about TI Wireless Product RF Hardware
- 【TGF4042 Signal Generator】+ Noise Test