You are on page 1of 4

We will show you how to use 8 LEDs controlled by microcontroller AT89C2051 engine create a sign or other graphic elements

in space.
Directorate of several months I noticed on the Internet with LED effect that I really liked. Last week I decided that it has put in place and then share with you the results of my work. I would like to ask in advance that you did not take this article as an accurate guide. Design of facility The base is well-designed mechanical layout. My requirements were: simple wiring use parts of "drawer stock" sufficiently powerful engine without gearbox suitable shaft for easy mounting arm engine speed around 1500 rpm / min low voltage motor (ideally to 12 V) electronic part I decided to use eight LED as a simple solution, but the main reason was the tiny cuprextite, but I was just at home. I suggested a simple diagram (see figure). The heart of the circuit is known Atmel AT89C2051 microcontroller (you can replace it with a newer number AT89S2051). Oscillator is composed of capacitors C3 and C4 and resistor R9 and Q1 crystal. RC consisting of C5 and R11 is used to automatically reset when the power supply connection. Had we not done it it, the microcontroller could get into an undefined state. Reset ensures that the program begins to address 0th For manual reset button is available. Pins P1.0 and P1.1 are equipped with pull-up resistors that define the logical level 1, so we have to get pins resistors R12 and R13 from the outside. Not exceed the sum of all output currents for the microcontroller 80 mA (short circuit current pin is 20 mA), so I used a 74LS245 circuit LED driver, which then can flow more current than 10 mA, and do not have to worry about load port P3 for extension wiring. To reduce current LEDs used resistors R1 to R8. Note that the LEDs light up a logical zero, it can be in this programming to watch. We are placing the plate on the completed first resistors, capacitors and LEDs. Pro microcontroller use precise slot. Cable length select so that you reach the other end of the arm where the battery is located. Plate and its installation can be downloaded.

I used a DC motor 12 V/60 W, which is provided with screw axis, which facilitate the attachment of my arm. I bolted the engine to a wooden board supported polystyrene for vibration suppression. The arm was made of aluminum with a length of 33 cm. The engine I screwed it 13 cm from the edge. At the long end is screwed with a board with LED. Battery to power electronics is helpful for flat 4.5 V battery. The battery will be used also as a counterweight. Place the battery (or you can add more weights) on the arm so that the arm balanced. This step is very important because otherwise you could be that instead of several hundreds or thousands of revolutions the engine will have only a few tens of turns, also shortens its life. In addition, make

sure the battery is very securely fastened to the shoulder and weights that they can not relax and possibly cause injury. Solder the power cable from the battery and electronic tape download cable throughout its length to the shoulder. As you surely know from the pictures, the motor powered from PC power supplies with an output of 200 W ptivoltov branches. The engine has around at 5 635 r / min. The motor is powered only five volts because the battery and attaching weights is done very precisely.

Program part The task will be to create a program that shows my nick XP over and over about once every 2 seconds zinvertuje this text, therefore if the text shining and the rest off, then the text will be lit and the rest will be lit. The most important condition, you have to meet is that the text always portraying the same place, which can be achieved in two ways - lighter and heavier. Easier way is that you manually set the time constant, so that your text was in place or slightly popojdl. The disadvantage of this approach is that any change in engine speed will lead to a block of text, ie its illegibility. Heavier method involves sensing the engine speed, the easiest way that I can think of is optical sensor mounted underneath the arm where it will interrupt a beam of light to permanently attaching plek substrates with the engine. Then you can programmatically adjust speed according to the time constant. I chose the automatic correction of time constants, but once I have more time to finish up recording speed and the result is share with you. Move on to describe his own program. First, we can see something, we must activate 74LS245 logic zero on pin P3.7. Register R2 to display time effect. Calculate it as the sum of the time required to display one word multiplied by the value of register R2 display the letter P + space between the letters display the letter + X + gap between words = 3.5 ms + 1 ms + 3.5 ms + 2.5 ms = 10 5 ms. Effect of display time: 10.5 ms * R2 = 10.5 * 200 ms = 2.1 s. If the motor rotates clockwise, then you need to issue the text backwards. Individual letters are plotting subroutine drawCH, which has two parameters. The first parameter specifies the char portrayed the character for character 'X' is a char equal to zero and 'P' is equal to one. The second parameter effect determines whether to invert the text. The letters 'X' and 'P' is stored in tables and charpi charX. The function determines the register R7 drawCH current table row. DPTR to the first address table stores just rendered character. Register content is moved to R7 battery. To save the battery, then the table row address in the DPTR and move in a table stored in the battery. In the following loop gradually to select individual rows of the table and send it to port P1. If set the effect, it negates the contents of the battery and sent to the port P1. Thus we draw the letter 'X' and 'P', insert a space between them with a length of 1 ms. After the invitation letters 'XP' to insert a space between words of length 2.5 ms. This time delay is a second important purpose as the time constant, which stabilizes the text in one place. Time 500 ms timer is made 0 in 16b mode. As likely to use a different engine speed with the other, you have sub-time according to your preferences.

;********************************************************************** ;************************* LIGHT 3D EFFECT **************************** ;********************************************************************** ORG 0 char equ R0 ;vykreslovan znak, 0/1 - X/P effect equ R1 ;volba efektu inverze: 0/0ffh - ano/ne CLR P3.7 MOV effect,#0 main: MOV R2,#200 = 200 * 10,5 ms = 2,1 s opak: MOV char,#1 CALL drawCH MOV P1,effect CALL t0m5 CALL t0m5 MOV char,#0 CALL drawCH MOV P1,effect CALL t0m5 CALL t0m5 CALL t0m5 CALL t0m5 CALL t0m5 DJNZ R2,opak CJNE effect,#0,jj nastav a naopak MOV effect,#0ffh JMP main jj: ;aktivace 74LS245 ;s efektem ;nastaven doby trvn jednoho efektu t ;nastav vykreslovan znak na P ;vykresli znak ;mezera mezi psmeny dlky 1 ms ;nastav vykreslovan znak na X ;vykresli znak ;mezera mezi slovy dlky 2,5 ms

;jestlie nebyl nastaven efekt, pak ho

;funkce drawCH ma dva parametry: char - vykreslovan znak, effect - efekt inverze drawCH: MOV R7,#0 CJNE char,#1,chp MOV DPTR,#charP JMP nextCH chp: MOV DPTR,#charX nextCH: MOV A, R7 MOVC A,@A+dptr CJNE effect,#0,cont CPL A MOV P1,A CALL t0m5 INC R7 CJNE R7,#7,nextCH RET db db db db db db db 10011111b 00001111b 00100111b 00100111b 00000000b 00000000b 11111111b

;adresa tabulky znaku p ;adresa tabulky znaku x ;do akumultoru ulo aktuln dek ;efekt - inverze textu ;zobraz jeden sloupec znaku ;doba zobrazen jednoho sloupce ;zvy posunut v tabulky

tabulky cont:

charP:

;tabulka znaku P

charX:

db db db db db db db

00111100b 00011000b 11000011b 11100111b 11000011b 00011000b 00111100b

;tabulka znaku x

t0m5:

MOV tmod,#1b MOV TH0,#0FCh MOV TL0,#25h CLR TF0 SETB TR0 JNB TF0,$ RET END

;nastav asova 0 v mdu 16bit ;vynuluj pznak peteen ;aktivuj asova ;ekej dokud se asova nenapln -

neubhne 500 us

You might also like