LPT port under Win 95 to Win ME with Visual Basic

I have made this site for all the people who want to learn about How to send and get Binairy data from your LPT Port with Basic and/or Visual Basic.

We are NOT RESPONSEBLE for any damage on your computer.

1. When you put something on your LPT Port , please do your computer off first
2. Don't put the out ports together.
3. On dataline in only 0 or +5V and absolute not more.

So , i shall try to explaine what the meaning is of this site.
Example.

I want to make a contoling center for my house.
That means :

----I want to click with my mouse and the light in the kitchen will be on.-----or at 7.00 AM my coffee will be hot
----or my radio will be on at 5.00 AM
----or ......     ( everything is possible )

When you want to do this , you need some things :
----A computer
----Basic or Visual Basic
----Electronic components for a Printboard
( i shall explain how to make one )

Ad1 : Computer.
          This can be an old one . example If you want to use Visual Basic a 486 with windows 95.
          or a 8088 for normal Basic.

Ad2 : The programm language Basic or Visual Basic. This is a very easy to learn and to handle.

 Ad3 : The printer board is also easy.
          Look at to my Stepperdriver board with ULN2803 for it.

Here is some Info about your LPT Port.

Pin nr
25pins

2
3
4
5
6
7
8
9

15
13
12
10
11

1
14
16
17

Pin nr
36pins

name

2
3
4
5
6
7
8
9

32
13
12
10
11

1
14
31
36

Data line 0
Data line 1
Data line 2
Data line 3
Data line 4
Data line 5
Data line 6
Data line 7

Error
Select
PE
Ack
Busy

Strobe
Auto Feed
Init
SLCT IN

Address

Data Direction

Basic Address , Bit 0
Basic Address , Bit 1
Basic Address , Bit 2
Basic Address , Bit 3
Basic Address , Bit 4
Basic Address , Bit 5
Basic Address , Bit 6
Basic Address , Bit 7

Basic Address +1 , Bit 3
Basic Address +1 , Bit 4
Basic Address +1 , Bit 5
Basic Address +1 , Bit 6
Basic Address +1 , Bit 7

 Basic Address +2 , Bit 0
Basic Address +2 , Bit 1
Basic Address +2 , Bit 2
Basic Address +2 , Bit 3

Out
Out
Out
Out
Out
Out
Out
Out

In
In
In
In
In, Inverted

In / Out , Inverted
In / Out , Inverted
In / Out
In / Out , Inverted

First you need a DLL to use your Lpt Port with Visual Basic.

My fiend wrote that piece of software for you ( not for windows2000).   poort.dll (196kb) and it is legal.

 Place this DLL in the windows directory.
Then you must make a Module to declare your variables.
Put this in your Module:

Declare Function SchrijfLPT Lib "poort.dll" (ByVal  PortAddress As Integer, ByVal PortData As Integer) As Integer

Declare Function LeesLPT Lib "poort.dll" (ByVal PortAddress As Integer) As Integer

 

Now you must use them.

The data you get and put to LPT Ports are always Binairy.
 That means :

Dec        Binair
   1  =  0000 0001 
Data line 1 will be high
   2  =  0000 0010  Data line 2 will be high
   3  =  0000 0011  Data line 1 and 2 will be high
   4  =  0000 0100  Data line 3 will be high
and so on.

example 1. The value of textbox 1 will be send to LPT1.
                  to get the value use the function Val and the LPT1 port has the address 888.

Make a button and an inputtextbox.
Dubbelclick at the button.
Write the following text:
Dim answer as integer
answer = SchrijfLPT( 888 , val(text1.text))

vbprog1.zip ( 2 kb ). 

 

 example 2. The value of LPT1 will be put in Textbox 1.
                  to get the value use the function LeesLPT .

 Make a button and an inputtextbox.
Dubbelclick at the button.
Write the following text:
text1.text  = str$(LeesLPT( 888 ))

 

 Some one has send me this program port.dll . I don't know if it's legal. port.zip(26KB)
The declaraions are in the .bas file.

The next program i have write for you is vbprog3.( 29 KB )
You can see on your screen 12 lamps and you can click on one of the lamps.
When you do that you will see that one of the pins of your lpt port wil be high.
Look to the program source and see how easy it is.

Now i show you how to controle a steppermotor .

If you want to controle it , you must know how they works.

The most steppers have 4,5,6,8 or 10 wires.
I shall show you how 5 and more wire steppers works.( Unipolair Stepper )

Data line 1
Data line 2
Data line 3
Data line 4

ULN2803

A
B
C
D

Here you can see how to connect a stepper to your computer.
See what happen when you makes Dataline 1 High and then  Dataline 2 High and then Dataline 3 High and so on.

Fig. 1

Fig. 2

Fig. 3

The motor turns to the right. This is Full Step.
There is also a posibility to make half step.
Fig 4 is dataline1 high . Fig 5 is dataline1and dataline 2 high.Fig 6 is dataline2 high  enz.

Fig. 4

Fig.6

Fig. 8

Fig. 5

Fig. 7

Fig. 9

This is the source code for fig 1 - fig 3 with Visual Basic.
LPT 1 address is 888 and is the same as H278

SchrijfLPT( 888 , 1)
SchrijfLPT( 888 , 2)
SchrijfLPT( 888 , 4)
SchrijfLPT( 888 , 8)

 in Basic

out 888 , 1
out 888 , 2
out 888 , 4
out 888 , 8

Most steppers are 180 steps / 360 grd. That means that you must repeat this program 180/4 = 45 times.

This is the source code for fig 4 - fig 9.

 SchrijfLPT( 888 , 1)
SchrijfLPT( 888 , 3)
SchrijfLPT( 888 , 2)
SchrijfLPT( 888 , 6)
SchrijfLPT( 888 , 4)
SchrijfLPT( 888 , 12)
SchrijfLPT( 888 , 8)
SchrijfLPT( 888 , 9)

Most steppers are 180 steps  / 360 grd. That means that you must repeat this program 180/4 = 45 times.