The circuit diagram is as follows:
Component list:
Name Quantity Specification/Model Remarks
Universal board 3 18*30cm
single-chip microcomputer STC15F2K60S2 1 DIP40 Unless you know how to change the program, please do not replace
74hc154 4 Both wide and narrow packages are available
40P IC holder 1
24P IC holder 4
Electrolytic capacitor 47uF 1
104 capacitor 1
Slide switch 1
Copper column (including nut) 4 M3*100mm
lamp beads 540 2*5*7mm mist color optional
bent pin header 1 Each group of 40P
straight pin header 8 Each group of 40P
white flying wire 2 Several
USB to TTL downloaders 1 PL2303 series or CH340 series
female to female DuPont wire 3 Each group of 40P
female to male DuPont wire 1 Each group of 40P
micro switch 1
The source program of the single-chip microcomputer is as follows:
/*Author: Wind Bell*/
#include "STC15F2K60S2.h"
#include "intrins.h"
#include "basic.h"
#define SET 0x00
#define CLR 0x00
#define Segs P0
#define Out P1
sbit Rest=P3^0;
void IO_int();
void Timer1Init(void);
Byte code table[]={
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,
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,
};
Byte code Segs_tab[]={
0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,
0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf,
0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf,
0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f,
};
void Timer0Init(void);
unsigned char Anm1=0;
unsigned int End,Anm=0;
void main()
{
EA=1;
End=sizeof(table);
IO_int();
Timer0Init();
while(1)
{
if(Rest==0)IAP_CONTR=0x60;
if(Anm>End)Anm=0;
Segs=Segs_tab[Anm1];
Out=table[Anm1+Anm];
}
}
void IO_int()
{
P0M1=0x00;
P0M0=0x00;
P1M1=0x00;
P1M0=0xff;
}
void Timer0Init(void) //100 microseconds @ 22.1184MHz
{
AUXR |= 0x80; //Timer clock 1T mode
TMOD &= 0xF0; //Set timer mode
TL0 = 0x5C; //Set the initial timing value
TH0 = 0xF7; //Set the initial value of timing
TF0 = 0; // Clear TF0 flag
ET0=1;
TR0 = 1; //Timer 0 starts timing
}
void delay() interrupt 1
{
TR0=0;
Anm1=Anm1+1;
if(Anm1>63)Anm1=0;
Out=CLR;
Segs=0xff;
TR0=1;
}
Previous article:89C52 single chip microcomputer controls ISD4004 voice chip, multi-segment recording and playback source code
Next article:51 single chip infrared control stepper motor
Recommended ReadingLatest update time:2024-11-17 12:51
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
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
- New breakthrough! Ultra-fast memory accelerates Intel Xeon 6-core processors
- New breakthrough! Ultra-fast memory accelerates Intel Xeon 6-core processors
- Consolidating vRAN sites onto a single server helps operators reduce total cost of ownership
- Consolidating vRAN sites onto a single server helps operators reduce total cost of ownership
- 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!
- Single chip digital stopwatch program
- EEWORLD University - Understanding and Optimizing Sampling Data Systems
- Did you feel disappointed after watching Avengers 4?
- In 2005, the market size reached 70 billion yuan, and the automotive electronics industry became popular.
- The other party pressed a key during a call! How can I identify the key pressed by the other party?
- Homemade STEVAL-IPM05F 3Sh board: FOC motor control 400V/8A non-sensing/sensing Hall/sensing encoder and other reference programs...
- Microcontroller programming using C library functions
- 【Development Kit for nRF52840】+Being beaten by nordic
- Host power management settings
- CircuitPython is being ported to NXP i.MX RT