For your concern, try to make sure you set LPT1 as your default parrallel port and set its address as '0x378' and then you can call this method - 'PortAccess.Output(888, 0);' through interop inpout32.dll. Write to parallel port in Windows 7. [DllImport('inpout32.dll', EntryPoint='Out32')] public static extern void Output(int adress, int value); } I tried using this code available at codeproject, although the program is not generating any errors I am not able to observe any output. I even installed inpout32.dll.
Days of research and programming have led me to try all variants of inpout32.dll and inpoutx64.dll: binaries, source code, 32-bit, 64-bit, address wrappers. None work: no change is seen to the output bits of the port.
However, I know it is possible, because using another commercially available program that does parallel port output, I can detect a trigger (state change) on all eight output bits (D0-D7) by passing a value between 0 and 255, exactly what I want to do in my own application.
I have followed all the advice from at least these pages:
I am using Windows 7, 64-bit; and my SIIG Cyberpro port is mapped as LPT3 at address 0xCCD8, with four status bits at address 0xCCD4. I have another ECP printer port mapped as LPT1 at 0x0378, but that does not work either.
I know better than to try direct _inp(), _outp() calls on Win7.
Can anyone help?
If I need to download and modify the driver code, I can do that if I have to, but I think it should not be that difficult.
My final version of code uses 32-bit compilation, interfacing to inpout32.dll:
1 Answer
FYI:
When I added
and called that function rather than Out32(ushort addr, ushort value) the code worked.
I don't know why the exact interface matters, but it does; and perhaps that is indeed because of sign extension on the 16-bit port address, as suggested [somewhere TBD].
shiprshipr