inpout32 is suddenly misbehaving

Discussion in 'Programmer's Corner' started by ue418, Aug 7, 2011.

  1. ue418

    Thread Starter New Member

    Jun 22, 2010
    17
    1
    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? 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.

    If you think I should post this on a different forum here, please let me know.

    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.

    Thanks,


    Rick
     
    Last edited: Aug 7, 2011
  2. ue418

    Thread Starter New Member

    Jun 22, 2010
    17
    1
    I found out that one should not use the Data register (pins 2 through 9) as both inputs and outputs. It should be one or the other. So I "opened up" my Status register (pins 10, 11, 12, 13 and 15), and switched my lone input to one of those pins. Everything works again, so it seems that the problem is solved. However, I still don't know why it worked for several years before suddenly refusing to work! I sometimes wonder if Windows or Microsoft programs (like VB) have hidden "timers" that turn off certain functionalities once a certain date is hit. As if to say, "Ahhh, nobody will be needing that after that data".
     
Loading...