Programming of 16X32LED dot matrix display screen based on 51 single chip microcomputer

Publisher:来来去去来来Latest update time:2020-01-28 Source: 51hei Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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                for(j=0;j<10;j++)
                        ;


........................................................................

[1] [1]
Reference address:Programming of 16X32LED dot matrix display screen based on 51 single chip microcomputer

Previous article:Microcontroller elevator controller code
Next article:Share the PWM wave program of stc15 microcontroller

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号