Design of 12864 LCD animation effect based on single chip microcomputer

Publisher:落寞梦惊Latest update time:2012-08-10 Source: 51heiKeywords:MCU  80C51 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Click to browse the next page

The design demonstrates the effect: the upper half of the screen displays static Chinese characters (* * *I believe you will succeed!), and the lower half of the screen displays animation effects (a hammer hitting a nail, and a looping effect of the hammer falling and the nail being driven in). The complete program source code can be downloaded from here http://www.51hei.com/f/12864dh.rar. Note that this is a screen without a font library. The circuit is as shown in the figure above, and the program has been tested successfully.

#include 
#define uchar unsigned char
#define uint unsigned int
sbit lcdcs1=P3^7;
sbit lcdcs2=P3^6;
sbit rs=P3^5;
sbit rw=P3^4;
sbit lcden=P3^3;
uint unm,mcu,unm1,unm2,unm3,uum;
uchar code table[]={0x00,0x00,0x08,0x88,0x88,0x9E,0xE4,0x44,0x5C,0x47,0x44,0xC4,0x04,0x00,0x00,0x00,
                    0x00,0x00,0x00,0x10,0x90,0x50,0x30,0xFF,0x28,0x48,0x88,0x88,0x00,0x00,0x00,0x00,
                    0x00,0x80,0x40,0xF0,0x08,0x06,0x10,0x50,0x50,0xFF,0xA8,0xA8,0x88,0x80,0x00,0x00,
                    0x00,0x20,0x20,0xA0,0xFF,0x90,0x10,0x00,0xF0,0x48,0x48,0x48,0x08,0xF8,0x00,0x00,
                    0x00,0x00,0x00,0x3F,0x04,0x02,0x01,0x01,0x02,0x04,0x20,0x7F,0x00,0x00,0x00,0x00,
                    0x00,0x20,0x1A,0x01,0x08,0x10,0x00,0x03,0x08,0x10,0x00,0x09,0x11,0x31,0x00,0x00,
                    0x01,0x00,0x00,0x3F,0x00,0x01,0x01,0x01,0x01,0x7F,0x00,0x04,0x08,0x07,0x00,0x00,
                    0x08,0x04,0x03,0x00,0x7F,0x00,0x01,0x00,0x1F,0x09,0x09,0x09,0x30,0x1F,0x00,0x00,
     0x80,0x40,0x20,0xF8,0x06,0x10,0x10,0x50,0x50,0x4A,0xAC,0xA8,0x08,0x08,0x08,0x00,
                    0x00,0x80,0x40,0xF0,0x0E,0x00,0x40,0x30,0x2E,0xA0,0x10,0x50,0x30,0x00,0x00,0x00,
                    0x00,0x80,0x40,0x20,0x50,0x4C,0x43,0x24,0x28,0x10,0x20,0x40,0xC0,0x80,0x80,0x00,
                    0x00,0x00,0x00,0xE0,0x20,0x20,0x27,0x78,0x90,0x10,0x12,0xC4,0x00,0x00,0x00,0x00,
                    0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x1D,0x15,0x15,0x12,0x1E,0x00,0x00,0x00,0x00,
                    0x01,0x00,0x00,0x3F,0x00,0x08,0x06,0x10,0x20,0x3F,0x00,0x02,0x04,0x0C,0x00,0x00,
                    0x01,0x00,0x02,0x32,0x2A,0x26,0x22,0x11,0x15,0x19,0x31,0x00,0x00,0x00,0x00,0x00,
                    0x20,0x10,0x0C,0x03,0x09,0x11,0x0F,0x10,0x09,0x06,0x09,0x10,0x20,0x40,0x78,0x00,
     0x00,0x00,0x20,0x20,0xF0,0x10,0x10,0x40,0x40,0xC0,0x3E,0x20,0x20,0xE0,0x00,0x00,
                    0x00,0xC0,0x60,0x50,0x2C,0xE0,0x80,0x40,0xA0,0x38,0x26,0x10,0xF0,0x00,0x00,0x00,
                    0x00,0x00,0x00,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
                    0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
                    0x02,0x02,0x02,0x02,0x21,0x11,0x09,0x04,0x03,0x10,0x20,0x10,0x0E,0x01,0x00,0x00,
                    0x00,0x07,0x19,0x09,0x08,0x1F,0x00,0x00,0x00,0x03,0x10,0x20,0x1F,0x00,0x00,0x00,
                    0x00,0x00,0x00,0x19,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
                    0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

     0x00,0x08,0x1C,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xDC,0xC8,0xC0,0xC0,
     0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xE0,0xF0,0xF0,0xF0,0xF0,0xE0,
      0xE0,0xF8,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFC,0xF8,0xE0,0x00,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
      0x00,0x10,0x38,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3B,0x13,0x03,0x03,
      0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x07,0x0F,0x0F,0x0F,0x0F,0x07,
     0x03,0x0F,0x1F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x1F,0x0F,0x03,0x00,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 

     0xE0,0xF8,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFC,0xF8,0xE0,0x00,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
     0xE0,0xF8,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFC,0xF8,0xE0,0x00,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
     0x03,0x0F,0x1F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x1F,0x0F,0x03,0x00,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
     0x03,0x0F,0x1F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x1F,0x0F,0x03,0x00,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

     0x10,0x18,0x18,0x1C,0x1C,0xFE,0xFE,0xFE,0xFE,0xFE,0x1C,0x1C,0x18,0x18,0x10,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
     0x00,0x00,0x00,0x00,0x00,0x0F,0x3F,0xFF,0x3F,0x0F,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,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,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,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,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,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,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,
     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,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,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,0x00,0x00,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

     0x00,0x08,0x1C,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xDC,0xC8,0xC0,0xC0,
     0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xE0,0xF0,0xF0,0xF0,0xF0,0xE0,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
     0xE0,0xF8,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFC,0xF8,0xE0,0x00,
     0x00,0x10,0x38,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3B,0x13,0x03,0x03,
     0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x07,0x0F,0x0F,0x0F,0x0F,0x07,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
     0x03,0x0F,0x1F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x1F,0x0F,0x03,0x00,

     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
     0xE0,0xF8,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFC,0xF8,0xE0,0x00,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
     0xE0,0xF8,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFC,0xF8,0xE0,0x00,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
     0x03,0x0F,0x1F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x1F,0x0F,0x03,0x00,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
     0x03,0x0F,0x1F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x1F,0x0F,0x03,0x00,
     };
     
void delay(int z)
 {
  int x,y;
   for(x=z;x>0;x--)
    for(y=0;y>0;y--);
 }
void writen_com(uchar com)
 {
  lcden=0;
  delay(1);
  rs=0;
  lcden=1;
  P0=com;
  delay(1);
  lcden=0;
  rs=1;
 }
void writen_dat(uchar dat)
 {
  lcden=0;
  delay(1);
  rs=1;
  lcden=1;
  P0=dat;
  lcden=0;
  delay(1);
  rs=0;
 }
void init()
 {
  mcu=0;
  lcden=1;
  rw=0;
  writen_com(0x3f);
  writen_com(0xc0);
  writen_com(0xb8);
  writen_com(0x40);
  lcdcs1=1;
  lcdcs2=0;
  }
 void main()
 {
  init();
 for(unm1=0;unm1<3;unm1++)
   {
    for(unm=mcu;unm
Keywords:MCU  80C51 Reference address:Design of 12864 LCD animation effect based on single chip microcomputer

Previous article:Mini operating system with semaphores and preemptive interrupt scheduling (based on 8051)
Next article:Waveform generator made by 51 single chip microcomputer

Recommended ReadingLatest update time:2024-11-16 22:50

DSP Optimization Method Based on XC166 Single Chip Microcomputer
       introduction        Compared with dedicated digital signal processors (DSPs), the DSP performance of Infineon's C166 microcontroller is quite poor. In order to improve the DSP processing capabilities of the C166 microcontroller, Infineon launched a new 16-bit microcontroller series XC166. The main difference
[Microcontroller]
DSP Optimization Method Based on XC166 Single Chip Microcomputer
Assembling 51 microcontroller button detection
Without further ado, let’s start with the code: ORG 00H LOOP: JB P3.4,LOOP LCALL DELAY JB P3.4,LOOP LOOP1:JB P3.4,LOOP JB P1.0,TC1 SETB P1.0 JMPLOOP TC1: CLR P1.0 JMPLOOP DELAY: MOV R7,#50 D1: MOV R6,#50 D2: DJNZ R6,D2 DJNZ R7,D1 RET END I won't talk about the static display of the digital tube, the dynamic displa
[Microcontroller]
Design of a low-cost true random number generator based on AVR microcontroller
introduction Random numbers have been widely used in simulation, sampling, numerical analysis, computer programming, decision-making, aesthetics and entertainment. There are two common types of random number generators: pseudo-random number generators that use mathematical algorithms and true random number generators
[Microcontroller]
Design of a low-cost true random number generator based on AVR microcontroller
C51 MCU Memory Optimization
  52 has 256B of data storage area. If you don't pay attention to some details, it is easy to get an error when the RAM exceeds 128. The following is an explanation of the problem:   The two most common ones are:   ① When the number of variables exceeds 128, the code must be compiled in compact mode. In practice, as l
[Microcontroller]
Antenna Pattern Automatic Test System Based on MSP430 Single Chip Microcomputer
    Antenna pattern is an important indicator of antenna. The purpose of antenna test is to test the radiation characteristics of antenna. Early antenna test mainly relied on manual work, which had large errors and low efficiency. With the development of computer application technology, automatic control systems for an
[Microcontroller]
Antenna Pattern Automatic Test System Based on MSP430 Single Chip Microcomputer
Realizing Asynchronous Serial Data Regeneration Using Single Chip Microcomputer
1 Introduction In the transmission network of modern mobile communications, synchronous digital hierarchy (SDH) optical transmission equipment is widely used. The auxiliary data channels provided by the optical transmission equipment of many mobile communication base stations retain asynchronous serial interfac
[Microcontroller]
Realizing Asynchronous Serial Data Regeneration Using Single Chip Microcomputer
51 single chip microcomputer lcd1602
{ Uchar i; for (i=0;i 16;i++)  {    DispOneChar(i,1,dd++);       dd &= 0x7f;    if (dd 32) dd=32; } } // Display cursor position void LocateXY( char posx, char posy)  { Flying tempo; temp = posx & 0xf; posy &= 0x1; if ( posy )temp |= 0x40; temp |= 0x80; LcdWriteCommand(temp,0); } // Display a
[Microcontroller]
Design of equivalent sampling oscilloscope based on microcontroller
Abstract: This paper introduces the method of equivalent sampling of high-frequency signals (1MHz ~ 80MHz) based on the precision clock generation circuit of the microcontroller system, and designs and implements a simple digital oscilloscope with an analog bandwidth of 1Hz ~ 80MHz. Keywords: MCU equivalent sampling di
[Test Measurement]
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号