*
Function: LED 16*16 dot matrix scrolling display
Note: 74LS154 is used to send data, and P0 and P2 ports are used to select columns.
The best tool for viewing this program is preferably one with labels and syntax coloring, Keil or UltraEdit is recommended
Lazy Tips: How to change the display content to what you want?
1. To change the displayed content, change lines 23 to 92 and line 119. For specific changes, see the comments below.
2. To change the scroll speed, change line 102
*/
/*head File*/
#include
#include
/*Macro definition*/
#define uchar unsigned char
#define uint unsigned int
/*Function declaration*/
void delay();
/*Global variables*/
uint lie; //column selection flag
/**
Font: reverse display, vertical modulus, add 32 0xFF at the beginning and end to improve the continuity of the loop when the screen scrolls **/
/**
Hangzhou Bus Company K316, bound for Wulin Square, departure time 20:30, welcome to take it! -- ** Songti, 12 **/
/**
The dot matrix corresponding to the next Chinese character of the currently selected font is: width x height = 496x16, after adjustment: 496x16 **/
uchar code text[1056]={
//The data here is the amount of data you want to display + 64 (32 0xff before and after)
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
//Change the display content. Do not change the above two lines.
0xEF,0xDF,0xEF,0x3F,0xE8,0xFF,0x00,0x00,0xED,0xFF,0xFE,0xFD,0xEF,0xF3,0xEC,0x0F,
0x6D,0xFF,0x8D,0xFF,0xED,0xFF,0xEC,0x03,0xEF,0xFD,0xEF,0xFD,0xEF,0xE1,0xFF,0xFF,
0xFF,0x7F,0xF8,0xFE,0xFF,0xF9,0xFF,0xE7,0x00,0x1F,0xFB,0xFF,0xFC,0xFF,0xFF,0xFF,
0x80,0x01,0xF7,0xFF,0xF9,0xFF,0xFE,0x7F,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
0xDF,0xFF,0xDF,0xFF,0xDF,0xFF,0xD8,0x03,0xDB,0xFF,0xDB,0xFF,0x5B,0xFF,0x80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,0xAB,0x77,0xAB,0x77,0xA0,0x2F,0xAF,0xCF,0xAF,0x9F,0x80,0x01,
0xAF,0xBF,0x6F,0xDF,0x60,0x4F,0x6D,0x67,0x6B,0x73,0xCB,0x77,0xEE,0x7F,0xFF,0xFF,
0xFF,0x7D,0xFE,0xFD,0xF9,0xDD,0xC7,0xDD,0xFB,0xDD,0xFC,0xDD,0xFF,0xDD,0x00,0x01,
0xFF,0x5D,0xFE,0xDD,0xFD,0xDD,0xC3,0xDD,0xFD,0xDD,0xFE,0xFD,0xFF,0xFD,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x05,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
//Change the display content. Do not change the following two lines.
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
};
/*Main function*/
void
main()
{
uchar i,j;
uint m=0; //m is the counter when fetching data from the font array, used to change the content of the displayed text and the scrolling display effect
SCON=0;
//Initialize the serial port to working mode 0 (synchronous communication mode, TxD outputs synchronous pulse)
lie=0x7fff; // column selection flag initialization
while(1)
//Repeat loop display
{
for(j=0;j<10;j++) //j is used to control the time that one frame of content stays on the screen, that is, to control the scrolling speed
{
for(i=1;i<=31;i+=2)
{
P0=0xff; //Turn off the display first to avoid adverse effects on the screen during the data movement in 164. You can remove these two sentences to compare the display effect.
P2=0xff;
SBUF=text[i+m]; //Send font data from the serial port (Why should the latter data be sent first? You will understand after looking at the circuit :)
while(TI==0); //Wait for sending to complete
TI=0;
SBUF=text[i+m-1]; //Send data from the serial port to complete a column of data
while(TI==0);
TI=0;
P0=lie%256; //Select the column to be displayed, which is equivalent to turning on the display of that column
P2=lie/256;
delay(); //Delay, wait for a while, so that the content displayed in this column can produce the "visual persistence" phenomenon in the human eye. People who know a little about physiology should know this.
lie=_iror_(lie,1); //Shift the column selection flag to select the next column
}
} //Return to display the next column until all 16 columns are displayed
m+=2; //Move the display content back one column
if(m>1024) //This data is the size of your font array - 32, mine is 1056-32=1024
m=0;
}
}
/*Delay subroutine*/
void delay()
{
uint n;
for(n=0;n<90;n++)
{;}
}
Previous article:The Production of Single Chip Microcomputer Pulse Measurement Instrument
Next article:Three-phase stepper motor drive circuit
- Popular Resources
- Popular amplifiers
- Displaying a large bitmap file on a dialog box, in its original size, is quite difficult in the VC++
- Multi-channel pressure measuring instrument based on C8051F020 single chip microcomputer
- Design of automatic player for work and rest signal based on 51 single chip microcomputer
- The most abundant 3G data
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Who knows the principle of voltage doubling circuit? No transformer or inductor is used, just a few diodes and capacitors...
- EEWORLD University ---- Sitara realizes intelligent servo
- 【GD32E503 Review】 Test screen display characters
- AM5708 platform transplants Ubuntu system and docker container
- Microchip Live FAQ|Manufacturing Logistics Challenges of Secure Key Provisioning: Advantages of Discrete Secure Elements
- Show the screen of E-coin exchange
- What exactly do you earn from a 5-yuan PCB proofing?
- Teach you to write microcontroller timer interrupt program
- Compilation warning: last line of file ends without a newline
- CC2541 Bluetooth Learning - General I/O Port Interrupt