KST-51: 8*8 dot matrix horizontal moving display IG!

Publisher:星辰耀眼Latest update time:2021-11-29 Source: eefocusKeywords:KST-51 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Use the module software to take horizontal modules of IG! frame by frame, and store the data of each frame (8*8 dot matrix screen) in a two-dimensional array. There are 18 frames in total.


In the image[][] array, the row element represents a frame, and the column element represents each line in the current frame. Through interrupt + switch traversal control, each frame is dynamically displayed, so that it looks like IG! Continuous horizontal movement is achieved.

Note: When taking the modulus, you need to take the modulus in the reverse direction, that is, assign 0 to the bright side and 1 to the dark side.

#include

 

sbit ADDR0=P1^0;

sbit ADDR1=P1^1;

sbit ADDR2=P1^2;

sbit ADDR3=P1^3;

sbit ENLED=P1^4;

 

unsigned char code image[17][8]=

{

{0xFF,0x83,0xEF,0xEF,0xEF,0xEF,0x83,0xFF},  

{0xFF,0xC1,0xF7,0xF7,0xF7,0xF7,0xC1,0xFF},

{0xFF,0xE0,0xFB,0xFB,0xFB,0xFB,0xE0,0xFF},

{0xFF,0xF0,0x7D,0x7D,0x7D,0x7D,0xF0,0xFF},

{0xFF,0x78,0xBE,0xBE,0xBE,0xBE,0x78,0xFF},

{0xFF,0x3C,0xDF,0xDF,0x5F,0xDF,0x3C,0xFF},

{0xFF,0x1E,0xEF,0xEF,0x2F,0x6F,0x1E,0xFF},

{0xFF,0x0F,0xF7,0xF7,0x17,0xB7,0x8F,0xFF},

{0xFF,0x87,0xFB,0xFB,0x0B,0x5B,0x47,0xFF},

{0xFF,0xC3,0xFD,0xFD,0x85,0xAD,0xA3,0xFF},

{0xFF,0xE1,0xFE,0xFE,0xC2,0xD6,0xD1,0xFF},

{0xFF,0xF0,0xFF,0xFF,0xE1,0xEB,0xE8,0xFF},

{0xFF,0x78,0x7F,0x7F,0x70,0xF5,0x74,0xFF},

{0xFF,0xBC,0xBF,0xBF,0xB8,0xFA,0xBA,0xFF},

{0xFF,0xDE,0xDF,0xDF,0xDC,0xFD,0xDD,0xFF},

{0xFF,0xEF,0xEF,0xEF,0xEE,0xFE,0xEE,0xFF},

{0xFF,0xF7,0xF7,0xF7,0xF7,0xFF,0xF7,0xFF}

};

 

void main()

{

 

EA=1;

ENLED=0;  

ADDR3=0;  

TMOD=0x01;  

TH0=0xfc;  

TL0=0x67;

ET0=1;

TR0=1;  

 

while(1);

}

void InterruptTimer0() interrupt 1

{

static unsigned char i=0;

static unsigned char tmr=0;  

  static unsigned char index=0; 

 

TH0=0xfc;  

TL0=0x67;

 

P0=0xff;

 

switch(i)

{

case 0:ADDR2=0;ADDR1=0;ADDR0=0;P0=image[index][0];i++;break;   

case 1:ADDR2=0;ADDR1=0;ADDR0=1;P0=image[index][1];i++;break;   

case 2:ADDR2=0;ADDR1=1;ADDR0=0;P0=image[index][2];i++;break;

case 3:ADDR2=0;ADDR1=1;ADDR0=1;P0=image[index][3];i++;break;

case 4:ADDR2=1;ADDR1=0;ADDR0=0;P0=image[index][4];i++;break;

case 5:ADDR2=1;ADDR1=0;ADDR0=1;P0=image[index][5];i++;break;

case 6:ADDR2=1;ADDR1=1;ADDR0=0;P0=image[index][6];i++;break;

case 7:ADDR2=1;ADDR1=1;ADDR0=1;P0=image[index][7];i=0;break;

default:break;

}

tmr++;

if(tmr>=250)

{

tmr=0;

index++;

if(index>=17)    

            {

index=0;

}

}

}

Keywords:KST-51 Reference address:KST-51: 8*8 dot matrix horizontal moving display IG!

Previous article:KST51 MCU: Detecting and debounce the number of matrix key presses through interrupts
Next article:KST-51: Countdown program starting from 999999, only the valid digits are displayed

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号