#include
#include
#define uchar unsigned char
#define uint unsigned int
#define SEG P0
sbit latch1=P2^7; //segment driver latch signal
sbit latch2=P2^6; //bit driver latch signal
uchar code DSY_CODE[]=
{
0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f
};
void DelayMS(uint x)
{
flying t;
while(x--)
{
for(t=120;t>0;t--);
}
}
void main()
{
fly i=0;
fly display[4];
uchar bit_com = 0x01;
display[0]=DSY_CODE[2];
display[1]=DSY_CODE[0];
display[2]=DSY_CODE[1];
display[3]=DSY_CODE[2];
while(1)
{
P0=display[i]; //segment control
latch1=1;
latch1=0;
P0=~bit_com; //bit select control
latch2=1;
latch2=0;
DelayMS(4);
i++;
bit_com = bit_com<<1;
if(i==4)
i=0;
if(bit_com == 0x10)
bit_com =0x01;
}
}
Previous article:51 single chip microcomputer driving buzzer and relay experiment
Next article:51 Serial communication interruption notice
- Popular Resources
- Popular amplifiers
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
- Development board based on TI AM5728 (floating point dual DSP C66x + dual ARM Cortex-A15)
- Agitek High-tech Joint Electronics Laboratory fully supports the National Undergraduate Electronics Design Competition
- Can the microcontroller detect negative values if it is powered by a single power supply?
- Signals and Systems (3rd Edition)
- Can a 100A current flow through a PCB? Tips for setting up high current paths
- hcnr201 isolation circuit problem
- recruitment
- KiCad 6.0.0 released
- RF front-end outsourcing
- Boot hardware settings