I remember the first time I saw a rotating LED was in a video half a year ago. I didn't know anything at the time. Why did it display like this? I just couldn't figure it out. Later, I bought a kit and made it, but I still couldn't figure it out. In fact, the kit doesn't need to be programmed. There is a way to directly generate a .HEX file, so it is a good choice for people who are lazy to program. But later, with the constant guidance and help of Baidu, I was finally able to program a small program by myself. Baidu gave me great help and taught me a lot. I would like to thank my great Baidu. Let me first talk about this legendary rotating LED that took a long time to make.
Hardware part:
(1) The base is powered by universal wireless power supply technology. Don't underestimate this thing. Although the circuit is simple, it is not easy to adjust. This broken thing wasted my energy for several days without eating or drinking. I usually see that they adjust it very well online and the power supply is also very stable. Why do I have so many problems? It's really speechless. The voltage value first increased from 0.8v to 1.3v. This voltage increase was because I adjusted the base voltage of the transistor. Then it increased from 1.3v to 1.8. This is because I changed a transistor, but this voltage still can't make the microcontroller work. What should I do? At this time, Hua Zi's half-wave and full-wave problem flashed in my head. I changed a rectifier bridge, and it increased to 3.3v. Although the current generated by this circuit presents a triangular wave, according to common sense, a half-wave is enough for me, but this really can't be done. Although the voltage at this time is 3.3v but it was extremely unstable, that is to say, the microcontroller always restarted and could not work continuously. At this time, I changed the power supply voltage to 12v. It was originally 5v power supply. The result was obvious. The microcontroller worked. I remember that the lights were off at this time of the day, but at night I thought about it for a long time and finally figured it out. I changed the capacitor (I remember bragging to others the next day that my head was a multi-functional oscilloscope). It worked. Now the 5v power supply voltage value is generally above 3.8v. At this time, I can finally assemble and test.
(2) Minimum system: This is very simple, but because I have high requirements for each of my works, it took me a long time to solder this thing. Another reason is that due to the problem of wireless power supply, you must pay attention to the selection of some things in the above minimum system, especially the selection of light-emitting diodes. Of course, if the wireless power supply is adjusted well, you don’t have to consider these. Another point is that you must not use the kind of three-color or seven-color flashing ones. As long as you use one, there will be problems. But I haven’t found the reason yet. It may be that the position of my thing is unreasonable. I will study it slowly in the future...
Software part:
If you only want to display a few words, it is very simple. If you want to do other things, it is a bit difficult. So for the primary version, I will simply let it display some words.
Flat word program:
void main(void)
{
uint i=0,j=0 ;
P1=0XFF;
P2=0XFF;
P3=0XFF;
//Only detect the right tube in the main program
while(1)
{
if(KEY==0) //Infrared receiving tube determines the starting position
{
j++;
if(j>320) //Define the number of words to be displayed and change the value to 320/16=20 words. After displaying 20 words, restart
{
j=0 ;
}
for(i=j;i<96+j;i++) //Advance one column per revolution Here, define 96/16=6 words to be displayed at the same time in one revolution,
{
P1=love[i*2]; //The low bit of subtitle data is sent to display
P2=love[i*2+1]; //The high bit of subtitle data is sent to display
DelayUs(210);//Delay to make the LED light up. The delay time for each column
P1=0XFF;
P2=0XFF;
}
}
}
}
There is also a small episode here, which is the problem of the initial size of the words. In fact, it is very simple to solve this problem. Some people use software to solve it, but I prefer to use hardware because it saves trouble. Just connect a few diodes in series on one end of the motor.
Reference address:Rotating LED based on single chip microcomputer (primary version)
Hardware part:
(1) The base is powered by universal wireless power supply technology. Don't underestimate this thing. Although the circuit is simple, it is not easy to adjust. This broken thing wasted my energy for several days without eating or drinking. I usually see that they adjust it very well online and the power supply is also very stable. Why do I have so many problems? It's really speechless. The voltage value first increased from 0.8v to 1.3v. This voltage increase was because I adjusted the base voltage of the transistor. Then it increased from 1.3v to 1.8. This is because I changed a transistor, but this voltage still can't make the microcontroller work. What should I do? At this time, Hua Zi's half-wave and full-wave problem flashed in my head. I changed a rectifier bridge, and it increased to 3.3v. Although the current generated by this circuit presents a triangular wave, according to common sense, a half-wave is enough for me, but this really can't be done. Although the voltage at this time is 3.3v but it was extremely unstable, that is to say, the microcontroller always restarted and could not work continuously. At this time, I changed the power supply voltage to 12v. It was originally 5v power supply. The result was obvious. The microcontroller worked. I remember that the lights were off at this time of the day, but at night I thought about it for a long time and finally figured it out. I changed the capacitor (I remember bragging to others the next day that my head was a multi-functional oscilloscope). It worked. Now the 5v power supply voltage value is generally above 3.8v. At this time, I can finally assemble and test.
(2) Minimum system: This is very simple, but because I have high requirements for each of my works, it took me a long time to solder this thing. Another reason is that due to the problem of wireless power supply, you must pay attention to the selection of some things in the above minimum system, especially the selection of light-emitting diodes. Of course, if the wireless power supply is adjusted well, you don’t have to consider these. Another point is that you must not use the kind of three-color or seven-color flashing ones. As long as you use one, there will be problems. But I haven’t found the reason yet. It may be that the position of my thing is unreasonable. I will study it slowly in the future...
Software part:
If you only want to display a few words, it is very simple. If you want to do other things, it is a bit difficult. So for the primary version, I will simply let it display some words.
Flat word program:
void main(void)
{
uint i=0,j=0 ;
P1=0XFF;
P2=0XFF;
P3=0XFF;
//Only detect the right tube in the main program
while(1)
{
if(KEY==0) //Infrared receiving tube determines the starting position
{
j++;
if(j>320) //Define the number of words to be displayed and change the value to 320/16=20 words. After displaying 20 words, restart
{
j=0 ;
}
for(i=j;i<96+j;i++) //Advance one column per revolution Here, define 96/16=6 words to be displayed at the same time in one revolution,
{
P1=love[i*2]; //The low bit of subtitle data is sent to display
P2=love[i*2+1]; //The high bit of subtitle data is sent to display
DelayUs(210);//Delay to make the LED light up. The delay time for each column
P1=0XFF;
P2=0XFF;
}
}
}
}
There is also a small episode here, which is the problem of the initial size of the words. In fact, it is very simple to solve this problem. Some people use software to solve it, but I prefer to use hardware because it saves trouble. Just connect a few diodes in series on one end of the motor.
Previous article:51 MCU 4×4 matrix key program
Next article:stc89c52+18b20 complete temperature collection together
Recommended Content
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- 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
MoreDaily News
- 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
Guess you like
- Exclusive violent disassembly of active noise reduction neck-worn voice smart headphones
- Introduction to TI_DSP link command file (*.cmd)
- 【Iprober 520 current probe】Magnetic field mode test and test summary
- RT-Thread Reading Notes] RT-Thread Study Chapter 5-6 Reading Notes
- Basic knowledge of MCU
- Writing Verilog Code for AD Sampling FPGA Program
- capacitance
- The basic principles and methods of SRIO error handling
- FPGA button problem
- How to effectively choose a lithium battery protection board