Continue to Site

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.

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

Parallel Port problem and inpout32.dll

Status
Not open for further replies.

ue418

New Member
I have been using inpout32.dll in my VB6 program for several years, for both reading from (pin 3) and writing to (a couple other pins) the parallel port. Regarding pin 3, my machine moves its stepper motor Clockwise while reading Pin 3 at every step, to see if it has gone from high to low. It goes low only when the motor gets to a certain angular position (an inductive sensor "closes" there, sending 12 V to the base of an npn transistor. Pin 3 is connected to the transistor's collector, which (using a pull-up resistor to a 5V source) goes to ground (low) when the base is excited by the 12 V. Otherwise, pin 3 is high.

Starting the last few days, it appears that the inpout32.dll is malfunctioning. Rather than reading Pin 3 as HIGH (which I know from my voltmeter that it is), it is always reading it as LOW. This of course means that the program thinks the motor has reached the sensor, and stops its movement before it has even begun. Furthermore, it is doing this same thing on two separate laptops! And I know (using a test program called pporttest.exe) that the pins are working properly, and can hold a charge, etc. So for these reasons, I don't think it could be the laptop(s). As I'm slowly stepping through the program, at the point where pin 3 (well, the entire byte really) is being read, I not only check that pin with voltmeter. As a further troubleshooting maneuver, I then disconnected the cable from the laptop, and checked pin 3 on the cable (so the laptop is not even connected). It still shows 4 or 5 Volts!! So again, I know that the collector is high. Yet, the program reads that pin as low.

Should I remove my inpout32.dll program, and download a new one? or at least, an old version that I have of it in storage? Is it possible that this could have gotten corrupted somehow? Or, is there some other potential explanation? Actually, I just tried that, replacing the inpout32.dll with a version in my files from 3 years ago. It didn't help. Any help from some of you that have some knowledge of parallel ports, or even just dll's, would be greatly appreciated. I tried to go into the dll and look at the "inp" function that does the reading, but most of it looked like nonsense in Notepad. I was thinking maybe that there is not only a lower voltage threshold which the dll considers as "high"/"on", but maybe there is also an upper threshold (say, 5 V), above which it no longer registers as "high", but rather "low"??? My collector voltage tends to be slightly above 5 Volts (5.05 to 5.08 Volts). Is that crazy? Again, any help would be tremendously appreciated.

EDITED at 9:40 pm EST, 7Aug2011: I switched between Pin 3 and Pin 9 of the cable, thinking that maybe just that one pin was "bad". Pin 9 is the 8th pin/bit of the "control" byte. So if it's on, it will add 2 to the 7th power to the value (i.e., 128). But unfortunately, the value read by inpout32 was still "25" (i.e. the zero, 2nd and 3rd powers of 2), rather than "25 + 128 = 153". I am truly at a loss now as to what is happening. I'm thinking I could try using one of the "status" pins, using the 379 address in addition to the 378?? That will take some program modification though. Also, I'm pretty sure the "control" pins (pin 2 for sure) still work fine as outputs. Pin 2 controls the pulsing for the stepper motor driver, and that still works if I bypass this sensor logic stuff.

Thanks a LOT,


Rick
 
Last edited:
A few questions (which may help others help you):

1) Is this the same laptop you have always used for this system - that is, you didn't recently switch things (ie, move from a desktop machine to the laptop, or move to a different laptop)?

2) What version of Windows are you using?

3) You didn't recently have any updates to the version of Windows you're using (auto or manual)?
 
Have you recently installed a new printer driver? A while ago I had a problem with the parallel port after doing that; the new driver seemed to trample over anything else which addressed the port. (I don't use inpout32.dll so can't say whether that may have been a factor).
 
Last edited:
Found the Solution, apparently

Thanks to all for your good responses and questions. Yes, it is the same laptop I've used for years with this machine. It's running Windows XP, and I don't go online with it, so I doubt it could have been updated recently. Same with the printer drivers. And Eric, I didn't look at that link directly, but I use a program "pporttest.exe", which is probably the same thing, or very similar. You type in the address, then you can read or write to that register, etc. It was definitely helpful.

It seems that one should not use the Data register (pins 2 through 9) as both input and output. Should be one or the other. I have switched my lone input over to the Status register (pins 10, 11, 12, 13 or 15), and now things are working again. I have no idea why it worked in that manner for years, however. Then suddenly stopped.

One additional question: In trying to solve the main issue, I began getting paranoid about possibly having damaged one or more of my Data register pins. They are working now, I guess. But when I use the pporttest.exe, two or three of the Data pins - when set to LOW - register different values (almost zero exactly) than all the others (which measure 0.21 V). All this is relative to the ground pins of course (pins 18 thru 25). And similarly, those same 2 or 3 pins, when turned HIGH, register a 3.41 V instead of 3.28 that the others show. Do you think that is anything to worry about?
 
hi ue418,
Not all PC parallel ports show the same levels, I have noticed differences in the actual levels of a Highs and a Lows in a number of PC's.
As long the levels meet the TTL switching levels I would say its not a problem.
 
Status
Not open for further replies.

Latest threads

Back
Top