• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

inpout32.dll??

Status
Not open for further replies.

shobhit_goel10

New Member
Hi I am using the parallel port of pc to run a stepper motor.. I have written a code in c but the port is not generating outputs.. i heard a file inpout32.dll is required so i downloaded it and placed in system32 folder in my win xp. still no outputs..

this code is supposed to output all 1's on pins 2 to 9, but its not..

#include <stdio.h>
#include <dos.h>
void main(void)
{
outportb(0x378,0xFF);
}

what may be the problem?
thanks..
 

Sceadwian

Banned
What operating system are you using? By the way, the DLL doesn't just magically work by popping it in your system32 directory.
 
Last edited:

ccurtis

Well-Known Member
You need to set bit 0 of the control register at 37Ah to 1 and then return it to zero to output each byte of data at the printer port, taking care not to disturb the other bits in the control register.

Before sending any data, you should initialize the port by setting bit 2 of the control register to 0 and returning it to 1 (normal setting). I would also disable interrupts from the printer port by setting bit 4 of the control register to 0 when initializing the port. Otherwise, if an interrupt occurs the operating system may set bits in the control register other than what you want them to be.
 

Sceadwian

Banned
For some programs you do ccurtis. He's using outportb to try to write to an address XP won't allow direct access to hardware ports like that. You have to use the XP API calls to write data the parallel port.
 
Last edited:

Sceadwian

Banned
Not if you use the API calls though. If you use the API calls you still can send parallel port data, you're just restricted to the API call limitations, I'm not sure what exactly those limitions are but I know they prevent custom bit twiddling of the status registers. If you're just trying to send normal Parallel data use the Windows API calls.
 

Sceadwian

Banned

ccurtis

Well-Known Member
OK - "When using Win XP a dll is required to enable DIRECT access to the parallel port".
That is not true. The printer port can be written to directly at its I/O address, just as the serial port can be written to directly at its I/O address with input/output statements. I have done it. Just try it and see.
 

Sceadwian

Banned
On Windows XP it does not work ccurtis. I have tried. Either you installed it yourself or through the course of the installation of another piece of software are using something similar.

For reference I'll post again.
http://www.lvr.com/parport.htm
 
Last edited:

ccurtis

Well-Known Member
I accomplished it less than a week ago. I used Borland's TurboBasic. With input and output statements I write and read directly to/from the registers and get the data out of the port. It works in interpeter mode and after being compiled into an exe file. The interpreter and the exe file, both, run on my machine running XP installed at Dell from where I bought the machine.
 

Sceadwian

Banned
TurboBasic must have it built in then, this is not the case for many other compilers/languages.
 

ccurtis

Well-Known Member
For all I know, TurboBasic just reads and write directly to the port addreses as the statement definitions claim. Beats me why it wouldn't work with another language.

Here's an exe I did for a poster here for toggling/reading lines for the serial port. I tested it by actual voltage measurements on the serial port pins.

http://www.electro-tech-online.com/threads/using-com-port-for-signalling.92792/#post737611

I've done outputting on the printer port, too.

When you tried it, I'm curious what happend. Did you get error messages, or did the data just not come out the port?
 

Sceadwian

Banned
ccurtis that's because you didn't read the link I provided twice... Or listen when both Eric and Nigel said the same thing before me. Windows XP and Vista do not allow direct access to hardware parallel ports unless there is a usermode driver or kernel extension installed on the machine. The inpout32.dll file in question has the needed code for I/O write to a parallel port embeded in it.

A serial port is not a parallel port. So at this point I'm wondering why you're posting at all because we're talking about two different things. The way windows itself interfaces with serial/parallel ports is simply different. The apparent direct access to the serial port is actually virtually done within the windows driver itself, your read/write io functions do not actually go to the hardware directly, windows hides all sorts of stuff like that. Those same read write functions will not work on a parallel port I/O address on a 'stock' Windows install other than 95/98. If you've done it to a parallel port then it was only a simple write function.
 
Last edited:

ccurtis

Well-Known Member
Sceadwian, yes, I see what you and the others mean, now.

I'm going on my own experience with TurboBasic, incorrectly thinking input and outputs statements are direct writes and reads as implied. The dll would be needed without its extensions, or add-ons.
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top