Menu English Ukrainian russian Home

Free technical library for hobbyists and professionals Free technical library


ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING
Free library / Schemes of radio-electronic and electrical devices

Another life of the LPT port. Part 3. Encyclopedia of radio electronics and electrical engineering

Free technical library

Encyclopedia of radio electronics and electrical engineering / Computers

Comments on the article Comments on the article

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.

Another life of LPT port
(click to enlarge)

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.

Another life of LPT port

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.

Another life of LPT port

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.

Another life of LPT port

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).

Another life of LPT port

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).

Another life of LPT port

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).

Another life of LPT port

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).

Another life of LPT port

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.

Another life of LPT portAnother life of LPT port

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

Another life of LPT port

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

Another life of LPT portor Another life of LPT port

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?

Another life of LPT port

Go ahead. The engine control program works, for example, according to such an algorithm.

Another life of LPT port

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.

<< Back

Latest news of science and technology, new electronics:

Artificial leather for touch emulation 15.04.2024

In a modern technology world where distance is becoming increasingly commonplace, maintaining connection and a sense of closeness is important. Recent developments in artificial skin by German scientists from Saarland University represent a new era in virtual interactions. German researchers from Saarland University have developed ultra-thin films that can transmit the sensation of touch over a distance. This cutting-edge technology provides new opportunities for virtual communication, especially for those who find themselves far from their loved ones. The ultra-thin films developed by the researchers, just 50 micrometers thick, can be integrated into textiles and worn like a second skin. These films act as sensors that recognize tactile signals from mom or dad, and as actuators that transmit these movements to the baby. Parents' touch to the fabric activates sensors that react to pressure and deform the ultra-thin film. This ... >>

Petgugu Global cat litter 15.04.2024

Taking care of pets can often be a challenge, especially when it comes to keeping your home clean. A new interesting solution from the Petgugu Global startup has been presented, which will make life easier for cat owners and help them keep their home perfectly clean and tidy. Startup Petgugu Global has unveiled a unique cat toilet that can automatically flush feces, keeping your home clean and fresh. This innovative device is equipped with various smart sensors that monitor your pet's toilet activity and activate to automatically clean after use. The device connects to the sewer system and ensures efficient waste removal without the need for intervention from the owner. Additionally, the toilet has a large flushable storage capacity, making it ideal for multi-cat households. The Petgugu cat litter bowl is designed for use with water-soluble litters and offers a range of additional ... >>

The attractiveness of caring men 14.04.2024

The stereotype that women prefer "bad boys" has long been widespread. However, recent research conducted by British scientists from Monash University offers a new perspective on this issue. They looked at how women responded to men's emotional responsibility and willingness to help others. The study's findings could change our understanding of what makes men attractive to women. A study conducted by scientists from Monash University leads to new findings about men's attractiveness to women. In the experiment, women were shown photographs of men with brief stories about their behavior in various situations, including their reaction to an encounter with a homeless person. Some of the men ignored the homeless man, while others helped him, such as buying him food. A study found that men who showed empathy and kindness were more attractive to women compared to men who showed empathy and kindness. ... >>

Random news from the Archive

Banana skin flour 07.10.2022

American researchers made flour from a banana skin and added it to the dough. The biscuits they made turned out to be healthier than the biscuits made from wheat flour. To make flour from banana skins, the researchers dried and ground the skins of ripe bananas into a fine powder.

By mixing flour with butter, milk powder, powdered sugar, vegetable oil and wheat flour, they baked a batch of cookies. Scientists have found fiber, magnesium, potassium, antioxidants and other important nutrients in banana peel flour.

In addition, biscuits made with banana peel flour were healthier, lower in fat and protein, higher in phenols, and better in antioxidant activity than regular biscuits.

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.

▪ HIV cures cancer

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

▪ article VHF FM receiver on the KXA060 chip. Encyclopedia of radio electronics and electrical engineering

Leave your comment on this article:

Name:


Email (optional):


A comment:





All languages ​​of this page

Home page | Library | Articles | Website map | Site Reviews

www.diagram.com.ua

www.diagram.com.ua
2000-2024