Page 1 of 1

Parallel port programming

Posted: Sat Nov 09, 2013 2:17 am
by Joakim Christiansen
First credit to the people leading me to this (I did not get their code working btw):
http://www.purebasic.fr/english/viewtop ... 12&t=36570 (Windows & Linux)
http://www.purebasic.fr/english/viewtopic.php?t=29852 (Windows only, port of DLL)

The reason I had problem getting it to work was because I needed the updated DLL file for x64 systems, this will install the needed (signed) driver (x32 or x64) automatically. It and the source code can be downloaded from here:
http://www.highrez.co.uk/Downloads/InpOut32/
For x32 and x64 systems one can use the x32 version of the DLL but for an x64 only application one must use the x64 version of the DLL.

Now I release some code updated for 5.20 LTS and using prototypes. Only for Windows though, if you need Linux support see the linked thread and make it work yourself.

Code: Select all

EnableExplicit

Prototype p_Out32(portAddress.w,value.w)
Prototype p_Inp32(portAddress.w)

Define i.u

If OpenLibrary(0,"inpout32.dll")
  Global pPortOut.p_Out32 = GetFunction(0,"Out32")
  Global pPortIn .p_Inp32 = GetFunction(0,"Inp32")
  For i=0 To 255
    pPortOut($378,i)
    Delay(100)
  Next
  CloseLibrary(0)
Else
  Debug 1
EndIf
I tested this with LED's (and resistors to limit the current) connected to my parallel port header (on the motherboard, yes a few have them) and got a nice flashy binary counter. Using Enhanced Parallel Port one can even use all those 8 pins as inputs too (check your BIOS), more information here:
http://retired.beyondlogic.org/epp/epp.htm
http://en.wikipedia.org/wiki/Parallel_port

Is it awesome?
Yes! Giving your computer IO ports that you can use as you like sure is handy!
I for example will try making it interface directly with an old floppy disk drive and make backups of some diskettes not readable by Windows.

Re: Parallel port programming

Posted: Sat Nov 09, 2013 9:26 am
by User_Russian
On, PureBasic written kernel driver and dll for it, similar to InpOut32. http://www.purebasic.fr/english/viewtop ... 05#p405305
Module for work with ports. http://www.purebasic.fr/english/viewtop ... 50#p418350

Re: Parallel port programming

Posted: Sat Nov 09, 2013 11:40 am
by luis
Both very interesting, I still love parallel (and serial) ports.

Thanks

Re: Parallel port programming

Posted: Sat Nov 09, 2013 1:07 pm
by Joakim Christiansen
User_Russian wrote:On, PureBasic written kernel driver and dll for it, similar to InpOut32. http://www.purebasic.fr/english/viewtop ... 05#p405305
Module for work with ports. http://www.purebasic.fr/english/viewtop ... 50#p418350
That is quite sweet, I'll try your driver too!
It is a little nicer when everything is coded in PB, thanks!

Re: Parallel port programming

Posted: Sat Nov 30, 2013 7:58 pm
by Psychophanta

Re: Parallel port programming

Posted: Mon Dec 02, 2013 10:25 am
by Joakim Christiansen