Valentine's Day gift solution! LED display shake full set of programs and source procedures
[Date: 2005-1-18]
Source: Author Kan SCM: nim
[Font: Large Medium Small]
Author: nim in http://www.21icbbs.com 2005-1-7 email: linyige@yahoo.com This design belongs to the author of all, please do not used for commercial purposes without permission, please indicate the author and source. What gifts we have given to the heart of MM? There is another month of the Valentine's Day, give you a simple circuit that is suitable as a gift, and the beautiful toys do it yourself will be the best gift for MM. Display effect picture UPLOAD / 2005_01 / 050118235926731.jpg Schematic http://www.21icsearch.com/buzi/upimage/upfile/20047221015470.jpg I have sent in the new garden Http://www.21icbbs.com/club /bbs/showannounce.asp?id=1288814 The following is a detailed description: the principle of graphic display: Use the visual pollivation effect of the human eye to make the hand when swinging to different locations, let LEDs on a straight line show twoD Different columns of images implements graphics scanning display. Physical mechanism: When we are swinging the arms, the swing position and left and right amplitude will not have too much change in a short period of time, using our arm's movement law, as long as you get the rod to swing from one side to the other side, then Dividing this time into N, then display different patterns in each time. When we are swinging your arms, we cannot know the time taken in advance, how to get the time from one side to the other side? Think about it, the swing frequency of our arm will not change in a short period of time. We will get the time used before the previous swing, and then use this time to get the next oscillate, then n-by Yes. The task of obtaining the time required for swing is done by the light shield, and a thin rod that can be swung on the rod, the slit of the thickness of the light-shield, the slit of the thickness of the light shield is slightly wide, I use the rectifier bridge A piece of pin is cut after welding. Swing once, swinging this rod once passed through a light-shifter, making the microcontroller to generate an interrupt, the time between the two interrupts is the time to get, and the function is implemented with a timer T0 and an external interrupt INT0 of 2051. Then use another timer T1 of 2051, the timing time is a n in T0, and each interrupt is displayed in turn, it is the effect on the photo. Think about it, when the frequency of the arm swing is greater than 2 Hz, it can probably be seen by the visual, and then more than a dozen Hz, which is 1051 clock frequency 1MHz by the longest time when T0 is 16-bit timer. The most appropriate, and the thickness of the shutoff lever can also be approximately estimated, making it not impact on the timing accuracy. Element used: AT89C2051 8 yuan high LED total 8 3.6 yuan battery box 0.5 yuan single-sided multimeter 8 yuan can be cut into 3 pieces, do three shake rod ceramic resonator 1 yuan light shield 2 yuan resistance capacitor wire 2 Yuan shell * 0.7 yuan can be cut into 2 optional elements: power switch 1 yuan total cost is not more than 20 yuan * shell I use the translucent folder that is built in Carrefour, this circuit circuit is very simple, code is short, but used By 2051 external interrupt programming and T0, T1 timer programming, very suitable for beginners practice. I made this toy spent two nights. This circuit and program also have an improved space. If you don't swing in the case of long-term, you can enter the power saving mode, and the display is not limited to the symmetrical picture, etc., you can try.
The following is the source program: / *************************************************** *****************************/// ---------------// LED rods shake display // --------------- // author: nim in http://www.21icbbs.com 2005-1-7 //// email: linyige @ yahoo. COM / / / This design copyright is owned by the author, please do not use the commercial purpose, please indicate the author and the source / ******************** *********************************************************** * / # include