Rotating LED based on single chip microcomputer (primary version)

Publisher:qin199099Latest update time:2015-07-09 Source: 51hei Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
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)

Previous article:51 MCU 4×4 matrix key program
Next article:stc89c52+18b20 complete temperature collection together

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号