Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Control Stepper motor with parallel port

Not open for further replies.


Member level 1
Dec 11, 2010
Reaction score
Trophy points
Activity points
Dear helpers,

I need help to code in vb6 that D1 of parallel port goes high then stepper motor have rotate forward to open door.... then D2 of parallel port goes low then stepper motor have to rotate reverse to close door...... how can make it in vb6.0..... i got references in C, but i want do in vb6.0.... anyone can help me....please please please it very urgent case....

There is no function in VB to access parallel port directly. You need to use a DLL like InpOut32.dll. Check this **broken link removed**
Option Explicit
Public Declare Function Inp Lib "inpout32.dll" _
Alias "Inp32" (ByVal PortAddress As Integer) As Integer
Public Declare Sub Out Lib "inpout32.dll" _
Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)
Private Declare Sub Sleep Lib "Kernel 32" (ByVal dwMilliseconds As Long)

You mean this coding right i have create module thn i put this coding this into module....... now how to code D1 goes high to rotate stepper motor rotate foraward few seconds... thn D2 goes low to rotate stepper motor rotate reverse few seconds.....

The question implies, that you have stepper motor controller generating the step frequency and motor waveforms on it's own. But you didn't mention the motor type or existing hardware.

The usual purpose of a step motor is to perform a step-accurate positioning. This won't be achieved, if the motor moves for- and backward, while a digital input is set. It's more common to perform individual steps by the controlling computer. Or output the phase signals (mostly four) from the computer and have a simple driver IC (like ULN2803) as motor interface.
Use the functions like this
' Forward
call Out (888, 01) ' 888 is the most common parallel port address. Check if yours is different in BIOS settings. 01 = Data port value (D1 = High)

call sleep(5000) ' Wait for 5 seconds. Note that this will make your application non-responsive. Use of Timer is recommended

' Reverse
call Out (888, 02) ' 02 = Data port value (D2 = High)

call sleep(5000) ' Wait for 5 seconds. Note that this will make your application non-responsive. Use of Timer is recommended

call Out(888, 00) ' 00 = Motor stop ?? (D1 = D2 = Low)
Yes Mr.FvM im using ULN 2803A T Base IC.... motor is unipolar type.... so cn u give me guide how to set D1 goes high then rotate motor few seconds???....

Thank Mr.CMOS.... i il try explore it....

To drive the stepper by ULN2803 without additional motor controller chips, you would connect four LPT port lines, one for each motor phase. And send the required signal pattern to drive the stepper motor from your VB program, either full or half steps. Just refer to the "Similar Threads" shown at the bottom of this page.
Not open for further replies.

Part and Inventory Search

Welcome to