Single chip microcomputer dot matrix case loop display love and "亲" word

Publisher:technology78Latest update time:2020-03-23 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

#include "main.h"


//define variables
unsigned char temp = 0xfe;
unsigned char KEY_NUM = 0;


unsigned char Display_word[4][4] = {
0x00,0x48,0x2A,0x8E,0xFB,0x0E,0x2A,0x48, //亲
0x0C,0x1E,0x3E,0x7C,0x7C,0x3E,0x1E,0x0C, //心
};






//********************************************************
//Main function
//********************************************************
void main()
{
unsigned int i;
unsigned char j,k;
while(1)
{
for(i = 0 ; i < 1000 ; i++)
{
temp = 0x7f;
for(j = 0 ; j < 2 ; j++) //Display the first two letters
{
for(k = 0 ; k < 4 ; k++) //One letter 4BYTE
{
Send_Byte(temp); //Column selection
Send_Byte(Display_word[j][k]); //Row data
LEDARRAY_LAT = 1; //Latch data
_nop_();

LEDARRAY_LAT = 0;
_nop_();
temp = (temp>>1)|0x80;
}
}
}


for(i = 0 ; i < 1000 ; i++)
{
temp = 0x7f;
for(j = 2 ; j < 4 ; j++) //Display the first two letters
{
for(k = 0 ; k < 4 ; k++) //One letter 4BYTE
{
Send_Byte(temp); //Column selection
Send_Byte(Display_word[j][k]); //Row data
LEDARRAY_LAT = 1; //Latch data
_nop_();

LEDARRAY_LAT = 0;
_nop_();
temp = (temp>>1)|0x80;
}
}
}


}
}


//********************************************************
//Send a byte of data
//****************************************************
void Send_Byte( unsigned char dat)
{
unsigned char i;
LEDARRAY_CLK = 0;
_nop_(); 
LEDARRAY_LAT = 0;
_nop_();


for( i = 0 ; i < 8 ; i++ )
{
if( dat&0x01)/*This is the bitwise AND operation in C language. dat is ANDed with 0000 0001.
              Then when the lowest bit of dat is not 0, it is if(1), which is true and the statement below if is executed.
  Otherwise, no matter what the other bits of dat are, if the last bit is 0, it is false and the corresponding statement is not executed. */
{
LEDARRAY_DI = 1; 
}
else
{
LEDARRAY_DI = 0;
}
LEDARRAY_CLK = 1; //Send data on rising edge
// _nop_();
LEDARRAY_CLK = 0;
// _nop_();

dat >>= 1; 

}

#ifndef __MAIN_H__
#define __MAIN_H__


#include
#include


sbit LEDARRAY_LAT = P3^6;
sbit LEDARRAY_CLK = P3^5; 
sbit LEDARRAY_DI = P3^4;


//函数或者变量声明
extern void Delay_ms(unsigned int n);
extern void Send_Byte( unsigned char dat);


#endif

Reference address:Single chip microcomputer dot matrix case loop display love and "亲" word

Previous article:51 single chip microcomputer realizes the birthday song
Next article:51 MCU review: 8*8 LED dot matrix

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号