Author Topic: inpout32 is suddenly behaving badly?  (Read 14187 times)

ue418

  • Member
  • ***
  • Posts: 3
inpout32 is suddenly behaving badly?
« on: August 07, 2011, 10:42:45 pm »
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 (because of 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? 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 as "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.

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 "data" 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.

Thanks for reading,


Rick

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: inpout32 is suddenly behaving badly?
« Reply #1 on: August 07, 2011, 11:01:04 pm »
If you want to use the data bits as inputs, set the port to "PS/2" or "byte" mode in the system BIOS and disable the data outputs by setting pin 5 of the control port = 1.

You mention also writing to a couple of port bits. These should be bits on the control port. Don't use the data port for both input and output unless you disable all external outputs that connect to the data lines before configuring the port as an output.

The status pins are always inputs so that would be an option.

See:

http://www.janaxelson.com/jansfaq.htm

Jan
« Last Edit: June 29, 2015, 10:19:55 am by Jan Axelson »

ue418

  • Member
  • ***
  • Posts: 3
Re: inpout32 is suddenly behaving badly?
« Reply #2 on: August 07, 2011, 11:26:16 pm »
Thank you Jan!   I saw your literature about the "5th Control bit" being HIGH for bidirectional Data.  But nothing I can find shows a fifth control bit.  There seems to be only C0, C1, C2 and C3 (pins 1, 14, 16 and 17, respectively).   So which pin corresponds to the C5?

Are you also saying that I cannot (or should not?) continue using the Data bits as output?  What if I continue using them (three of them anyway) for output, but add a new address (H379 I think) to my program, and begin using one of the Status bits (pins 15, 13, 12, 10 or 11)  as my lone input?   Would that not be acceptable?  Or you really think I'm playing with fire if I continue to use 3 of the Data bits for output?  Also, can you imagine a scenario that could have caused my input to suddenly fail?  Maybe the BIOS changed?  If today was Jan. 1, 2000, I would blame it on Y2k!!    Thanks again for reading and responding before.


Rick

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: inpout32 is suddenly behaving badly?
« Reply #3 on: August 07, 2011, 11:33:26 pm »
>nothing I can find shows a fifth control bit.  There seems to be only C0, C1, C2 and C3 (pins 1, 14, 16 and 17, respectively).   So which pin corresponds to the C5?

It's not a pin; it's internal.

>Are you also saying that I cannot (or should not?) continue using the Data bits as output?  What if I continue using them (three of them anyway) for output, but add a new address (H379 I think) to my program, and begin using one of the Status bits (pins 15, 13, 12, 10 or 11)  as my lone input?   Would that not be acceptable? 

That should work.

>Or you really think I'm playing with fire if I continue to use 3 of the Data bits for output?

Use the entire data port as input or output, not some bits as one and some the other.

>  Also, can you imagine a scenario that could have caused my input to suddenly fail?  Maybe the BIOS changed? 

OS update?

Jan


ue418

  • Member
  • ***
  • Posts: 3
Re: inpout32 is suddenly behaving badly?
« Reply #4 on: August 07, 2011, 11:50:47 pm »
I will modify my program and start using Data only for my outputs, and Status for my lone input!   If I understand you correctly, I will therefore not have to mess with the 5th Control bit.

Many thanks,


Rick

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: inpout32 is suddenly behaving badly?
« Reply #5 on: August 08, 2011, 10:54:53 am »
Yes.

Jan