The following is the program source code:
/******Dot matrix LED displays I LVOE U**************/
/**
*Function: The dot matrix LED delays one second to display I heart-shaped U (I LOVE YOU)
*Author: Xu Ran
*Date: 2013-06-12
*Remarks: The program was successfully debugged
**/
/*************AT89C52-RC MCU*******************/
/**************51hei development board********************/
#include
typedef unsigned int uint;
typedef unsigned char uchar;
sbit din = P2^0;//Data input end
sbit cs = P2^1;//Chip select end
sbit clk = P2^2; //Clock signal end
//Word module encoding
uchar code dis[][8] = {
{0x00,0x3C,0x18,0x18,0x18,0x18,0x3C,0x00}, // 'I'
{0x00,0x6C,0xFE,0xFE,0x7C,0x38,0x10,0x00}, // 'Heart'
{0x00,0xC3,0xC3,0xC3,0xC3,0xC3, 0x7E,0x3C} // 'U'
};
//
delay
:xms
void delay(uint xms)
{
uint
x
, y;
for (x =
0
; x <
xms
; 8; i++)
{
clk = 0;
din = (dat & 0x80);
dat <<= 1;
clk = 1;
}
}
//Write MAX7219 data
void write_max7219(uchar address, uchar date)
{
cs = 0;
write_byte(address);//write address
write_byte(date); //write data
cs = 1;
}
//MAX7219 initialization
void max7219_init()
{
write_max7219(0x0c, 0x01);
write_max7219(0x09, 0x00);
write_max7219(0x0a, 0x04);
write_max7219(0x0b, 0x07);
write_max7219(0x0f, 0x00);
}
//Main program
void main(void)
{
uchar i, j;
max7219_init();
while(1)
{
for(j = 0; j < 3; j++)
{
for(i = 0; i < 8; i++)
{
write_max7219(i+1, dis[j][i]);
delay(1);
}
delay(1000);
}
}
}
Previous article:MCU timer to achieve real-time clock program - lcd1602 display
Next article:Single chip microcomputer controls dot matrix LED to refresh the display in one second.
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- There may be a cure for the bald self! Tencent AI analyzes the cause of male baldness for the first time
- [TI recommended course] #Boost and buck-boost DCDC converters help wireless charging design#
- Arduino online simulation website wokwi
- EMC Design in RFID Applications
- [NXP Rapid IoT Review] Classic Snake purely hand-typed
- TMS320VC5509A DSP Learning Route
- SPI device driver learning BUG problem record
- Linux Application Development Manual Based on ARM AM335x
- C6748 Data width problem
- Construction of TI cc2541 protocol stack development environment