ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING Another life of the LPT port. Part 3. Encyclopedia of radio electronics and electrical engineering Encyclopedia of radio electronics and electrical engineering / Computers Each of you for sure (since you are reading this text) have come across floppies, CDs, etc. in your life. disk drives, printers, scanners, in general, devices that include a stepper motor. Now let's turn it on. The figure below is a diagram that I found on the Internet. Let the author forgive me, I don’t give a link to it (I just don’t remember where I found it), but if he sees this article, he will recognize his scheme. In fact, everything is fair, everything works. You can lay out a bunch of all sorts of schemes, but now it is important for us to understand not the principle of operation of the circuit, but the principle of supplying control signals to the engine. The diagram below shows this. Pulses are alternately applied to each of the motor windings, sometimes there is a high signal level on two windings at once. If you look at the left side of the diagram and notice D0-D3, you will immediately understand where I am getting at. That's what we end up with, and, of course, a computer with an LPT port. You will have to do the power for the engine yourself, and for each type of engine - your own. According to the diagram, we feed 3, 2, 6, 4, 12, 8, 9, 1 through &H378 in sequence to inputs A, B, C, D. And where to start is not critical, the question is to maintain the sequence and repeat it in a "circle" or as much as necessary. If you change the direction of the sequence (back to front), the rotation of the motor will be in the opposite direction. This sequence instructs the motor to take half steps (it depends on the design of the motor), for full step control the sequence would be 3, 6, 12, 9. And then a seven-segment indicator on LEDs from a calculator caught my eye. The decision came instantly. Here's how such an indicator works. For simplicity, I drew a 4-digit (there are 12 of them in my indicator) seven-segment indicator on LEDs. We supply 1 to bits 4-0, and supply + power to the segments (each type of indicator has its own power parameters). All segments are combined, so you need to light such an indicator with a dynamic indication. Anyone who has ever assembled an electronic watch himself knows what it is, but just in case, we will consider it in more detail. Step 1. A low signal level is applied to the first digit, and the code of the digit that we want to see is set on the segments (high level). Step 2. A low signal level is applied to the second digit, and the code of the digit that we want to see is set on the segments (high level). Step 3. A low signal level is applied to the third digit, and the code of the digit that we want to see is set on the segments (high level). Step 4. A low signal level is applied to the fourth digit, and the code of the digit that we want to see is set on the segments (high level). And again on a new step 1, 2, etc. All this happens very quickly, so our eyes do not have time to see the flickering numbers. We take our indicator and put bits 1, 2, 3, 4 on STROBE(1), AUTO(14), INIT(16), SELECT IN(17). This will be the control of the digits, and we put segments A, B, C, D, E, F, G on D0, D1, D2, D3, D4, D5, D6. To ignite in the first digit, for example 1 (segments B, C), you need to apply the number 378 to the address &H6, and 37 to the address &H197A. And here is the finished program - an electronic clock. There are 2 buttons on the form. The first starts the clock, the second stops. The parameter Z = 0.004 was selected empirically. If you do not set a delay, then the numbers merge, everything happens too quickly, and the LED does not have time to go out. Option Explicit Declaring a library for working with LPT port addresses Private Declare Function DlPortReadPortUchar Lib "dlportio.dll" (ByVal Port As Long) As Byte Private Declare Sub DlPortWritePortUchar Lib "dlportio.dll" (ByVal Port As Long, ByVal Value As Byte) Dim I, J As Integer Dim Z As Single Dim A As String Private Sub Command1_Click () J = 1 'loop resolution Z = 0.004' delay Do While J <> 0 DoEvents A = Mid$(Time$, 5, 1) 'read units of minutes DlPortWritePortUchar &H37A, 197 'let the first bit light up writetime 'display units of minutes A = Mid$(Time$, 4, 1) 'read tens of minutes DlPortWritePortUchar &H37A, 198 'let the second bit light up writetime 'display tens of minutes A = Mid$(Time$, 2, 1) 'read units of hours DlPortWritePortUchar &H37A, 192 'let third bit light up writetime 'display hour units A = Mid$(Time$, 1, 1) 'read tens of hours DlPortWritePortUchar &H37A, 204 'allow fourth bit to light up writetime 'display tens of hours If J = 0 Then Exit Do loop DlPortWritePortUchar &H378, 0 End Sub Public Sub writetime() Select Case Val(A) Case Is = 0 I = 63 'code 0 for a seven-segment display Case Is = 1 I = 6 'code 1 for a seven-segment indicator Case Is = 2 I = 91 'code 2 for a seven-segment display Case Is = 3 I = 79 'code 3 for a seven-segment display Case Is = 4 I = 102 'code 4 for a seven-segment display Case Is = 5 I = 109 'code 5 for a seven-segment display Case Is = 6 I = 125 'code 6 for a seven-segment display Case Is = 7 I = 7 'code 7 for a seven-segment indicator Case Is = 8 I = 255 'code 8 for a seven-segment display Case Is = 9 I = 239 'code 9 for a seven-segment display End Select DlPortWritePortUchar &H378, I 'write code for a seven-segment indicator Pause (Z) 'delay End Sub Private Sub Command2_Click () J = 0 DlPortWritePortUchar &H378, 0 End Sub 'Delay procedure. Call format: Pause(number of seconds) Public Sub Pause(Value As Single) Dim Start, Finish Start = Timer Do While Timer < Start + Value DoEvents loop Finish=Timer End Sub
This is how it works in real life. I will not describe the connection of fluorescent indicators, but to be honest I tried it - it works. I applied a positive potential to the discharge grids, grounded the filament, and applied 1 to the segments through D0-D6. Everything glows. I have not tried LCD indicators, I need to figure out where to get 64 Hz. If anyone connects, I will be glad to receive a diagram from you. By the way, an interesting idea - you can make a running line on LEDs to display alphanumeric information. In general, once again I am convinced that this port is an excellent tool for creativity. Here is another small topic about electric motors. Not everyone has stepper motors, and it is not always convenient and necessary. Let's try to get by with a simple motor with a gearbox, for example, to precisely move a certain device in a horizontal plane. Let it be a pencil or felt-tip pen. The engine is connected to a reduction gear, which in turn is connected to a threaded axle. A disk with metal sectors (contact pads or slots for optics) is rigidly fixed on a threaded axis, for example, such
or This is no longer important, the important thing is that, knowing the thread pitch, for example, a pitch of 1 mm, we have 4 sectors, which means that for a full turn of the disk the carriage will move forward by 1 mm, and for a quarter of a turn - by 0,25 mm. The number of sectors can be any - as many as you want. But what do we get now?
Go ahead. The engine control program works, for example, according to such an algorithm.
The control goes through the D0-D7 buses and/or through the &H37A port, the commands from the actuators (sensors) go to the &H379 and/or &H378. In general, then your imagination and possibilities. The same principle is logical to use to move the carriage in a perpendicular plane. And here you have a machine with movement in two directions. Those. building a CNC machine at home (computer numerical control) is quite REAL. Author: Alexey Klyushnikov, Ivanovo; Publication: cxem.net See other articles Section Computers. Read and write useful comments on this article. Latest news of science and technology, new electronics: Artificial leather for touch emulation
15.04.2024 Petgugu Global cat litter
15.04.2024 The attractiveness of caring men
14.04.2024
Other interesting news: ▪ New Large Can DirectFET MOSFET IRF6718 ▪ Electronic innovations in service in Iraq ▪ Determining ripeness using neural networks ▪ Mice recognize rats by the smell of tears. News feed of science and technology, new electronics
Interesting materials of the Free Technical Library: ▪ section of the site Microcontrollers. Article selection ▪ article Bayer Adolf von. Biography of a scientist ▪ article Does a rattlesnake rattle before attacking? Detailed answer ▪ article Black alder. Legends, cultivation, methods of application ▪ article Birdsong imitator. Encyclopedia of radio electronics and electrical engineering
Leave your comment on this article: All languages of this page Home page | Library | Articles | Website map | Site Reviews www.diagram.com.ua |