Why does Nobody Know Nothing About PC PCI Parallel Cards???  - Page 1
Forum section: electronics / general

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 30, 2015, 04:54:14 pm
content: Dear Software Gurus,Now I understand, I cannot understand everything, something has to be hidden from me before I enter my grave.I can be happy, it is said that a fool knows more and more each day while the wisest of men knows less and less. What does this say about women??In fact I searched for hours on the web to find some info about interfacing with the ports of a PCI Parallel Port card,.nuttin!Finally I found one company, Lavasoft that actually had tech support for their add-on cards. What I got from was a most courteous reply, but all this guru of tech support told was that he had no experience with directly accessing these ports with software, didn't have a clue!Really!The XP device manager shows the port addresses, the memory addresses used, but they remain lost upon the great sea of software, esoteric ports of call, yet unexplored.I just wonder then, these ports undoubtedly work well with printers, how in the world did the software and hardware engineers who design these cards have managed to find this information?Still PCI portless in Seattle...

author: Ice-Tea
author_rank: Super Contributor
timestamp: April 30, 2015, 04:57:04 pm
content: Heh... Legacy ports. Had me some fun with PS2 keyboards a few years ago. About as much documentation as you have for your device

author: Marco
author_rank: Super Contributor
timestamp: April 30, 2015, 05:03:17 pm
content: I think you need slightly less or slightly more pharmaceuticals before postingWhat's the problem exactly? These ports work exactly the same as a standard parallel port, just at a different base address which you already found.PS. is your question how to access the parallel port under windows xp period and the PCI part just useless extra information? In that case, doesthishelp?

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 30, 2015, 05:10:19 pm
content: If you see my recent post about Entry Points, the legacy port access problem has been in at least two programming languages, has..uhmm..kinda mostly solved.That is true Marco, I have the port address but no programming language can directly access these ports, as far as I know.

author: donotdespisethesnake
author_rank: Super Contributor
timestamp: April 30, 2015, 05:11:46 pm
content: Yeah, it can be hard getting info about obsolete technologyIf you have the IO address, that is all you need.If you want to remap the address to a standard address, that may or not be possible depending on the card.

author: donotdespisethesnake
author_rank: Super Contributor
timestamp: April 30, 2015, 05:13:38 pm
content: Quote from: SuzyC on April 30, 2015, 05:10:19 pmIn the code you posted :Quote&H378 is the port address (hex).

author: Marco
author_rank: Super Contributor
timestamp: April 30, 2015, 05:15:21 pm
content: Quote from: SuzyC on April 30, 2015, 05:10:19 pmYou were being so specific about the PCI, I thought it was relevantI edited my post, but I'll repeat here ...thisseems a pretty thorough list of all the ways to easily access the parallel port under different flavours of windows (without writing your own custom driver).

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 30, 2015, 05:19:29 pm
content: While 0x378..etc range ports are accessible with legacy ports with a few hard to find .dll's, PCI ports have port addresses up there in the port clouds, like the one I have: 0xDFE0-DFE7http://janaxelson.com/parport.htmhas a lot of legacy info, but the three letters "PCI" are not seen there.

author: tszaboo
author_rank: Super Contributor
timestamp: April 30, 2015, 05:23:36 pm
content: Usually they are shipped with a floppy disk containing the driver for Windows 95 and Dos. Maybe you should send a fax to the manufacturer, they might be able to help you.

author: donotdespisethesnake
author_rank: Super Contributor
timestamp: April 30, 2015, 05:26:07 pm
content: Quote from: SuzyC on April 30, 2015, 05:19:29 pmSo? It's just a 16 bit address, your VB code won't care.

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 30, 2015, 05:27:30 pm
content: Send a Fax?I don't know Chinese!

author: SuzyC
author_rank: Frequent Contributor
timestamp: April 30, 2015, 05:33:18 pm
content: My VB code may not care but VB does not have any intrinsic port manipulation so support port in/out is out of this world, not to mention that those few .dll drivers that I have found do not allow use of the IO words to peek at those ports above 32767.

author: Marco
author_rank: Super Contributor
timestamp: April 30, 2015, 06:01:09 pm
content: Lets be absolutely clear here.You triedthislibrary and it didn't work with the address?

author: suicidaleggroll
author_rank: Super Contributor
timestamp: April 30, 2015, 06:06:20 pm
content: I have to ask...-WHY- are you starting a new development using a parallel port in the first place?

author: donotdespisethesnake
author_rank: Super Contributor
timestamp: April 30, 2015, 07:29:16 pm
content: Quote from: SuzyC on April 30, 2015, 05:33:18 pmLOL, you are impossible to help. Even when people give you the answer, you refuse to believe it.

author: Towger
author_rank: Super Contributor
timestamp: April 30, 2015, 09:07:41 pm
content: Open LPT1 etc as a random access file, write data to it and close the file. On Windows XP and higher the OS will capture the data into the print queue and output it to the port. On older OSs the data will be sent direct to the port. There are also DLL calls etc which can assess the port directly.

author: amyk
author_rank: Super Contributor
timestamp: May 01, 2015, 12:15:41 am
content: Quote from: SuzyC on April 30, 2015, 05:33:18 pmYou'll probably have to use negative numbers to get at the ones above 32767 (0x7FFF); it wraps around so 32768 (0x8000) is -32768, 32769 is -32767, and this keeps going until 65535 (0xFFFF) which is -1.http://en.wikipedia.org/wiki/Two's_complement

author: Ed.Kloonk
author_rank: Super Contributor
timestamp: May 01, 2015, 12:25:06 am
content: Quote from: SuzyC on April 30, 2015, 05:33:18 pmThe 1997 book "Visual Basic 5.0 Programmer's Guide to the Win32 Api" had an included module for VB supplied with the book to facilitate direct port IO.http://www.amazon.com/Applemans-Visual-Basic-Programmers-Guide/dp/1562764462HTH.

author: joeqsmith
author_rank: Super Contributor
timestamp: May 01, 2015, 03:19:38 am
content: Been a very long time. If you are using a protected OS you may not be able to do peeks pokes inp outp, etc. OS may trap these. There was a good article in Dr Dobbs back in the 90s (NT days) that covered how to change the exception tables. My old PROM programmer came with a program that would change the tables. Seems like some of the dongle guys offered these tools as well.Labview used to have a peek poke function in the Windows 3.x 95 days. Long gone with NT.

author: janoc
author_rank: Super Contributor
timestamp: May 01, 2015, 12:31:04 pm
content: Quote from: joeqsmith on May 01, 2015, 03:19:38 amI think that this is the issue, in fact. Trying things like inp(), outp(), peek and poke in BASIC on any modern OS that runs in protected mode is hopeless. This is not a ZX Spectrum or DOS when your program "owned" the entire machine.Your user mode program simply doesn't have direct access to the hardware and for a good reason - it would be trivial to seriously hose the machine if you could manipulate arbitrary ports or memory addresses.Then there is the entire issue of virtual memory and how the physical address space is actually mapped to the address space of your running process - port 0xDFE0 for your process could be mapped to a different physical address for another program.If you really want to directly access I/O ports, you need to go through some system calls. In the case of Windows you will find that you most likely need to install your own device driver for direct port access. Those drivers run in the privileged mode and can do such things. Alternatively, there are libraries that can simplify the process for you using the existing system APIs.In Linux it is a bit easier because the hardware is exposed to user space through a special virtual filesystem and device files and if you don't need interrupts or DMA, you can do a lot without writing custom drivers. However, you will need appropriate privileges (typically root user access) to manipulate those files, normal user cannot do it.

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 01, 2015, 01:06:08 pm
content: Thanks Janoc.. but that is the whole point.it is my machine,I bought it, I own it, I am a programmer and electronics nerd, if I want to ace the kernel twiddling with ports, then my machine is my kernel to ace!

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 01, 2015, 01:21:47 pm
content: suicidaleggroll, good question: Why use aPCIparallel port?(1) The programming language interface to the standard parallel port is so simple, compared to trying to use a serial communication add-on like FTDI USB I/O or else attempting to get with MSComm.(2) All others are not, maybe a way irequires creating a modem interface, hundreds of lines of code.(3) An USB interface can create connections whose software can crash the operating system, mandating a reboot,(4) At least the legacy parallel port allows me to have a fairly fast and direct hardware interface with my projects, why not PCI.(5) I have several older computers with legacy parallel port connectors that can be now used for MCU debugging or machine control or home automation etc, but are limited to one parallel port to connect directly to the outside world.. A PCI parallel port card could add others.(6) A misstep with a probe zapped the parallel port on a powerful newer motherboard and it is now worthless on my bench to do something really useful with it.

author: suicidaleggroll
author_rank: Super Contributor
timestamp: May 01, 2015, 01:22:57 pm
content: Quote from: SuzyC on May 01, 2015, 01:06:08 pmThen use an operating system that is designed with the same philosophy (read: not Windows or OSX).

author: SeanB
author_rank: Super Contributor
timestamp: May 01, 2015, 01:25:12 pm
content: If it is Windows you merely are renting it, the OS is a copyrighted item, and you are not allowed to modify it without paying for a MSDN subscription and having the certification to use the published API calls.You probably want to look up the supplier of the generic cards, some have released open source datasheets and have released source code for the drivers and for the programming of the interfaces.

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 01, 2015, 01:27:28 pm
content: Towger, Thanks, but silly boy, you suggest the most slow way to do things, a one-way trip. I wanna do in as well as out.I don't wanna print to the PCI port, I already have a driver for that that came with the card, I want to have a PCI fast port i/o interface to the real world.

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 01, 2015, 01:35:34 pm
content: Thanks Ed.Kloonk,but pray tell, does it have a chapter on how to interface with a programming language to manipulate PCI ports with any Win operating systems >Win2000 since the book's publishing date was something like 1997?

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 01, 2015, 01:44:55 pm
content: Thanks Amyk,Using inpout32.dll and VB6, low port numbers work perfect, but attempting to step trough my program and use inp or out to a port number above 32767 causes the VB6 IDE to report, "Visual Basic has encountered a problem and must close."I haven't tried negative numbers yet, but I expect the same results to the neg. equivs. to &HDFE0-&HDFE7

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 01, 2015, 01:50:13 pm
content: Thanks SeanB,I guess I am being just a little naughty!Do you know of any PCI Parallel card that has any open-source driver posted on the web..I don't.

author: Karel
author_rank: Super Contributor
timestamp: May 01, 2015, 02:08:41 pm
content: Quote from: SuzyC on May 01, 2015, 01:06:08 pmIn that case, you have to install an open-source operating system.With windows, you don't (completely) own your pc. Microsoft is in charge about what you are allowed to do with it.At least as long as you are running windows...

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 01, 2015, 02:36:12 pm
content: Declare bool hockey as Constant*This_Pointer to anyone who can't code anything more than a SMS message on a smartphone. Complete nonsense that I need to find another operating system.These PCI ports are being used by Windows 6 and 7 programs by those few who have figured it out.

author: Ed.Kloonk
author_rank: Super Contributor
timestamp: May 01, 2015, 02:44:49 pm
content: Quote from: SuzyC on May 01, 2015, 01:35:34 pmAs the poster who replied after me pointed out, the NT kernel got adopted not long after that book was published.Win98 was the last MS OS that I produced any code on.

author: Monkeh
author_rank: Super Contributor
timestamp: May 01, 2015, 03:04:43 pm
content: Perhaps this will help your unGoogleness:http://www.internals.com/

author: mikerj
author_rank: Super Contributor
timestamp: May 01, 2015, 03:10:07 pm
content: Quote from: Karel on May 01, 2015, 02:08:41 pmAre you saying Microsoft's Windows license prevents people directly accessing their printer ports? i.e. DLPortIo, inpout32 etc. are actually illegal to use as they contravene the MS licence? If not, then what point are you making?

author: Bassman59
author_rank: Super Contributor
timestamp: May 01, 2015, 03:13:56 pm
content: Quote from: mikerj on May 01, 2015, 03:10:07 pmThe point is that Suzy and Karel are both confused. Bill Gates isn't telling anyone that it's against the EULA to directly access the parallel port. Windows (like OS X and Linux and ....) is a multiuser, multitasking operating system which necessarily has to abstract peripherals so the whole thing works as users expect.This whole thread is pretty stupid.If Suzy wants to peek and poke, she can look on eBay for an Apple ][.

author: suicidaleggroll
author_rank: Super Contributor
timestamp: May 01, 2015, 03:24:11 pm
content: Quote from: SuzyC on May 01, 2015, 01:21:47 pm1) Are you sure? The fact that this thread has reached 3 pages without a solution tells me it's not as simple as you're suggesting...2) What?3) Only with a hopelessly broken driver or a shitty OS4) I'm not talking about PCI, I'm talking about parallel ports. They are so ridiculously obsolete that the fact you're attempting to do ANY new development using them is laughably sad5) See #4, I'm not talking about PCI, nobody here is talking about PCI, we're all talking about parallel ports6) Yet another reason not to use parallel ports!You need to step back and look at the real problem. What you're looking for is GPIO from a general purpose desktop computer. A parallel port is the -WRONG- solution to this problem, as I'm pretty sure this thread has made painfully obvious. There are literally TONS of external devices you can use to give you GPIOs from a general purpose computer usingmoderninterfaces that won't disappear any time soon (or in this case, already disappeared over a decade ago). For example AccesIO has a lot of options with PCI, PCIe, and USB interfaces and up to 96 GPIOs per device, plus other models with analog I/O, optical isolation, etc. Some of them can run at very high speeds as well.For a simple option:http://accesio.com/go.cgi?p=../usbp/usbp-dio16ro8.html16 TTL/LVTTL I/O with 32mA current capacity, USB interface, full driver support with example code for Linux and Windows.

author: Macbeth
author_rank: Super Contributor
timestamp: May 01, 2015, 03:52:18 pm
content: Suzy, I think I can help.I used to use the freeware DriverLINX PortIO when hitting the parallel port in Windows XP. The evil philanthropist Bill Gates never forced me to stop using it and switch to Linux instead like some of the nice misanthropists in this thread seem to be advocating.DriverLINX webpage is no longer, but it's still available for download at the bottom of this page,Winford Engineering downloadsFrom what I can tell it only works in 32 bit and in Windows 7+ you need to set it to run in compatibility mode with XP.Hope that helps

author: LabSpokane
author_rank: Super Contributor
timestamp: May 01, 2015, 04:30:18 pm
content: Holy shit.A three page thread focused on "high-speed" access to a parallel port with ... I still can't believe I read this ... VB.

author: neslekkim
author_rank: Super Contributor
timestamp: May 01, 2015, 04:40:20 pm
content: Quote from: suicidaleggroll on May 01, 2015, 03:24:11 pmKinda expensive, but this kind of solution would be better if one need to do things like this from an pc.Adafruit also have an solution to this:https://www.adafruit.com/products/2264with tutorial:https://learn.adafruit.com/adafruit-ft232h-breakoutAnd seeedstudio have this:http://www.seeedstudio.com/depot/FT2232H-USB-20-HiSpeed-breakout-board-p-737.htmlAnd I suspect that there are many more ways..

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 01, 2015, 05:07:51 pm
content: Adafruit FT232H Breakout - General Purpose USB to GPIO+SPI+I2CPRODUCT ID: 2264$14.95OUT OF STOCKPrograms in Python?http://accesio.com/go.cgi?p=../usbp/usbp-dio16ro8.html$189 + Shipping and TaxVersus:My Own PC's = $0.00I can't believe I posted so much just to save a lousy $200 bucks!Are you all millionaires?http://www.seeedstudio.com/depot/FT2232H-USB-20-HiSpeed-breakout-board-p-737.htmlThis is only $27.00 + ship+tax, butdriver code is in Delphi

author: LabSpokane
author_rank: Super Contributor
timestamp: May 01, 2015, 05:21:04 pm
content: Quote from: SuzyC on May 01, 2015, 05:07:51 pmI think he's merely a thousandaire.

author: Monkeh
author_rank: Super Contributor
timestamp: May 01, 2015, 05:23:23 pm
content: Quote from: SuzyC on May 01, 2015, 05:07:51 pmDo a little bloody research!http://www.ftdichip.com/Support/SoftwareExamples/CodeExamples.htmhttp://www.ftdichip.com/Support/SoftwareExamples/MPSSE.htm

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 01, 2015, 05:28:39 pm
content: Macbeth:Thanks a million, they do have a driver for their USB I/O cards with an easy interface to Win Xp easy to interface with VB6.http://www.winfordeng.com/support/download.phpThanks Monkeh:I didn't see these links at first, thanks for input pointing this out.

author: suicidaleggroll
author_rank: Super Contributor
timestamp: May 01, 2015, 05:29:36 pm
content: Quote from: SuzyC on May 01, 2015, 05:07:51 pmLook again, it's $89. The $189 one includes high current relay controlled outputs. I'm not saying it's the only option, just that it'sAoption, and they provide insanely good customer support. They'll even go as far as writing custom programs to use their hardwarefor you, for free, provided your requirements are not too complex. I ordered a board once that needed different power and I/O voltages (5v power, 3.3v I/O). I emailed them to ask what the best way to accomplish that was (where to run a jumper wire, what resistors to remove, etc.), and instead they just did the modification for me for like $10 extra (on a $400 board).As I said in my post, there are literally tons of options though, ALL of which are better than using a parallel port.

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 01, 2015, 05:38:12 pm
content: Monkeh, Thanks for your help!My mom said "It is better to light one candle than to curse the darkness."Some here would say, "It is better to burn your old PC's than use a PCI card to light a single LED."Give my poor PC's and Parallel Port PCI's some amnesty!

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 01, 2015, 05:49:59 pm
content: Thanks very much again, neslekkim, you have the good character to offer encouragement where others offer only criticism.

author: Karel
author_rank: Super Contributor
timestamp: May 01, 2015, 06:57:53 pm
content: Quote from: mikerj on May 01, 2015, 03:10:07 pmNo. Since win2000/XP, it's not possible anymore to access the hardware. Only when you write your one driver for which youneed a microsoft SDK.With an opensource OS like Linux, you can easily access the LPT port. First blacklist the default parallel port/printer driver.Then you can access the hardware directly (when you have root privilege). There are lots of programming examples on theinternet that demonstrate how to do that. Even writing a small kernel mode driver for Linux that does what you want is easy.Not the hassle like windows.

author: free_electron
author_rank: Super Contributor
timestamp: May 01, 2015, 07:35:59 pm
content: first, there are no ports above 32536 (or whatevre 2^15 is ).PCI is mapped in the linear memory space of protected mode. there is a hole created in the old 'port' scheme that gets remapped. When you write to the old port addresses the southbridge recreates the operation to the correct memory.the old ports used IORD and IOWR in combination with the lower 15 address bits of the databus of the 8086 cpu.anything that uses a bridge no longer has iord and IOWR signals. that memory space is gone and virtualized in the southbridge.the southbridges have a reduced pincount isa interface where data is streamed. that is how they implement legacy crap like serial ports , printerports etc.SO : PCI is not mapped in Io space but in main memory space.Cards are mapped on the fly. so you cannot use hardcoded addresses. what is valid in your computer isnot valid in another machine. During boot the PCI map is built and a list is created telling you what card sits at what address. your driver interoperates with the Os and gets a handle. all operations are based on this handle + offset.It is all dynamic. you tell the os ; i need this board ( VID and PID ) and the Os tells you : here is the base address. go ahead.this stuff is all obsolete. modern machines don;t even have PCi slots anymore. only PCIx ports.

author: suicidaleggroll
author_rank: Super Contributor
timestamp: May 01, 2015, 07:47:34 pm
content: Quote from: free_electron on May 01, 2015, 07:35:59 pmI believe you mean PCIe or PCI Express. PCIX is another obsolete interface, like AGP.

author: oPossum
author_rank: Super Contributor
timestamp: May 01, 2015, 08:42:34 pm
content: Windows 7 Ultimate 64 bit, Xeon W3520, X58, 6 GB RAMPCI Express parallel port card with Oxford chipsetWinIO driver fromwww.internals.com(thanks Monkeh!)Visual BASIC .NET codeCode:Imports System.Runtime.InteropServicesImports System.ThreadingModule Module1<DllImport("WinIo64.dll")> Public Function InitializeWinIo() As BooleanEnd Function<DllImport("WinIo64.dll")> Public Function ShutdownWinIo() As BooleanEnd Function<DllImport("WinIo64.dll")> Public Function GetPortVal(ByVal PortAddr As UInt16, ByRef pPortVal As UInt32, ByVal Size As UInt16) As BooleanEnd Function<DllImport("WinIo64.dll")> Public Function SetPortVal(ByVal PortAddr As UInt16, ByVal pPortVal As UInt32, ByVal Size As UInt16) As BooleanEnd FunctionSub Main()InitializeWinIo()Const port As UInt32 = &HD880Dim leds As Byte() = {&H1, &H2, &H4, &H8, &H10, &H20, &H40, &H80, &H40, &H20, &H10, &H8, &H4, &H2}DoFor Each x In ledsSetPortVal(port, x, 1)Console.WriteLine("{0:X4} = {1:X2}", port, x)Thread.Sleep(200)NextLoop While Not Console.KeyAvailableConsole.ReadKey()ShutdownWinIo()End SubEnd Module

author: Mechatrommer
author_rank: Super Contributor
timestamp: May 02, 2015, 01:56:46 am
content: 4 pages.... let me clear some bit up about Windows and Modern OSes (including Linux perharps)... its not that they dont let you access to your hardware.... its just they dont let you access to your hardware DIRECTLY as you please, you want the access? you can! but you have to be IN QUEUE, thats the way. there is RATIONALE to this... modern OS is like a very busy traffic policeman in the middle of 100 junctions, every junctions we have cars or motorists that request (IRQ) to pass the junction to the other side (USER), among the motorists are internet data, wifi bluetooth printer mouse keyboard, mcu embedded that is connected to LPT, plethora of conected usb devices etc. this trafficman need to manage all of them to avoid clashing. now how the OS designer do this with ease, managable and in a safe and modern way? they built layers, one on top rely on the other one below, one on the topmost cannot access directly to the bottommost, they have to pass the one directly below it, they are encapsulated in their own right. the topmost layer is who? you! the user. roughly speaking the layers are:1) kernel the OS (this is the layer that access the hardware directly, handle the irq, manage and queue them)2) driver (kernel will pass, or the driver will fetch in from kernel about the request, get the necessary data from the hardware, perharp through the assigned pointer handle given by the kernel)3) api (the request, info or data will further be requested by api, this is where most of us have access to)4) app (this is what we build)5) useri maybe wrong in some details or order, but i'm certain there are layers that you cannot simply poke as you please without going through the top layers. you ask why i cant? because the OS will not let you, why? i have the right! right? yes you have the right but you dont have the clue. as proven many times before, directly access to hardware or memory can impose a security and safety threat. hackers may poke in, ill user/programmers may hog or screw another app on the same or another thread, it may render OS disfunctional, or even burn something. so they wont let you, for you own sakeness.mourning about this OS do not let you this or that, license or legal bullshit this or that is like accusing the OS is a religious pius, where its nothing more than they simply want to impose some safe science behind it. now you want to get through? to access your hardware? you have to follow the R&R, ie follow the layers, and that is what you are looking for, thats what you need to find in google or elsewhere if you want to play P&P or modern OSes. mourning will not help.

author: oPossum
author_rank: Super Contributor
timestamp: May 02, 2015, 05:20:31 pm
content: Updated code with run time DLL load & linkNow checks for error return from WinIo driverBuilds as 32 or 64 bit (either will run on 64 bit)Visual Studio 2013 Community EditionCode:Imports System.Runtime.InteropServicesImports System.ThreadingModule Module1<DllImport("kernel32.dll")> Public Function LoadLibrary(ByVal name As String) As IntPtrEnd Function<DllImport("kernel32.dll")> Public Function FreeLibrary(ByVal handle As IntPtr) As BooleanEnd Function<DllImport("kernel32.dll")> Public Function GetProcAddress(ByVal handle As IntPtr, ByVal name As String) As IntPtrEnd Function<UnmanagedFunctionPointer(CallingConvention.StdCall)>Delegate Function InitializeWinIoType() As Boolean<UnmanagedFunctionPointer(CallingConvention.StdCall)>Delegate Sub ShutdownWinIoType()<UnmanagedFunctionPointer(CallingConvention.StdCall)>Delegate Function GetPortValType(ByVal PortAddr As UInt16, ByRef pPortVal As UInt32, ByVal Size As Byte) As Boolean<UnmanagedFunctionPointer(CallingConvention.StdCall)>Delegate Function SetPortValType(ByVal PortAddr As UInt16, ByVal pPortVal As UInt32, ByVal Size As Byte) As BooleanSub Main()Console.WriteLine("{0} bit", IntPtr.Size * 8)Dim winio As IntPtrIf IntPtr.Size = 4 Thenwinio = LoadLibrary("WinIo32.dll")ElseIf IntPtr.Size = 8 Thenwinio = LoadLibrary("WinIo64.dll")ElseConsole.WriteLine("Unsupported system")Exit SubEnd IfConsole.WriteLine("WinIo DLL Module Handle: {0:X}", winio)If winio = IntPtr.Zero ThenConsole.WriteLine("WinIo library could not be loaded")Exit SubEnd IfDim fp As IntPtrfp = GetProcAddress(winio, "InitializeWinIo")If fp = IntPtr.Zero ThenConsole.WriteLine("Could not get address of InitializeWinIo")FreeLibrary(winio)Exit SubEnd IfDim InitializeWinIo As InitializeWinIoType = DirectCast(Marshal.GetDelegateForFunctionPointer(fp, GetType(InitializeWinIoType)), InitializeWinIoType)fp = GetProcAddress(winio, "ShutdownWinIo")If fp = IntPtr.Zero ThenConsole.WriteLine("Could not get address of ShutdownWinIo")FreeLibrary(winio)Exit SubEnd IfDim ShutdownWinIo As ShutdownWinIoType = DirectCast(Marshal.GetDelegateForFunctionPointer(fp, GetType(ShutdownWinIoType)), ShutdownWinIoType)fp = GetProcAddress(winio, "GetPortVal")If fp = IntPtr.Zero ThenConsole.WriteLine("Could not get address of GetPortVal")FreeLibrary(winio)Exit SubEnd IfDim GetPortVal As GetPortValType = DirectCast(Marshal.GetDelegateForFunctionPointer(fp, GetType(GetPortValType)), GetPortValType)fp = GetProcAddress(winio, "SetPortVal")If fp = IntPtr.Zero ThenConsole.WriteLine("Could not get address of SetPortVal")FreeLibrary(winio)Exit SubEnd IfDim SetPortVal As SetPortValType = DirectCast(Marshal.GetDelegateForFunctionPointer(fp, GetType(SetPortValType)), SetPortValType)If Not InitializeWinIo() ThenConsole.WriteLine("Error initializing WinIo driver")FreeLibrary(winio)Exit SubEnd IfConst port As UInt32 = &HD880Dim leds As Byte() = {&H1, &H2, &H4, &H8, &H10, &H20, &H40, &H80, &H40, &H20, &H10, &H8, &H4, &H2}DoFor Each x In ledsConsole.WriteLine("{0:X4} = {1:X2}", port, x)If Not SetPortVal(port, x, 1) ThenConsole.WriteLine("Error setting port value")Exit DoEnd IfThread.Sleep(100)NextLoop While Not Console.KeyAvailableConsole.ReadKey()ShutdownWinIo()FreeLibrary(winio)End SubEnd Module

author: janoc
author_rank: Super Contributor
timestamp: May 02, 2015, 08:58:06 pm
content: Quote from: SuzyC on May 01, 2015, 01:06:08 pmUm, well, certainly nobody is preventing you from doing so. However, you have to use the APIs that are provided by the OS of your choice for the purpose. That's all what I have to say to this.

author: Jeroen3
author_rank: Super Contributor
timestamp: May 02, 2015, 09:11:33 pm
content: Quote from: janoc on May 02, 2015, 08:58:06 pmThen please run bare-metal code on your machine. Adding an operating system to your machine requires you follow the design rules of the particular operating system.In case of Windows 8+, it requires you to write a 64 bit WHQL signed driver to access IO in a non-standard way. The driver sdk is free iirc.

author: free_electron
author_rank: Super Contributor
timestamp: May 02, 2015, 09:16:10 pm
content: Quote from: janoc on May 02, 2015, 08:58:06 pmnobody is preventing you form doing it. just tell the operating system what you want to do and what hardware you want to access, and it will let you, but you have to do it using the mechanisms designed for that purpose. in this case : write a kernel mode driver.

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 02, 2015, 11:06:27 pm
content: Dear Software Gurus,Thanks oPossum, congratulations!I have compiled with VS2010 in C# target X86 and ran the Winio.zip sample program called DumpPort on my target PC with my 2-port PCI Parallel Port card with no luck.The Winio .dll and .sys file were put in the same folder as the .exe file on my desktop. I also put the Winio32.dll in the Windows\System32 folder. The XP Device Manager shows that the card is working normally and has added LPT2 and LPT3 to my XP X86 SP3 platform.The program runs without any errors, but I what I see is no change looking at the Parallel Ports, namely base address of &HDFE0, &HDFE1 or &HDFE2 of the Parallel Port connector when the logic levels are manually changed with the help of shorting wires at the connector pins. These are the ports shown in the Device Manager for the PCI card installed on my X86 32-bit XP platform: 0xDFE0-DFE7 and DF98-DF9F (first PCI parallel port shown as LPT2)(second parallel PCI port on this card shown as LPT3 has also two different port ranges: 0xDF90-DF97 and DF80-DF8F)Why do PCI Parallel Port cards like mine have two sets of port ranges for each of the ports?Perhaps, I am using DumpPort to examine the wrong port addresses?Could it be that only some PCI Parallel Port cards will work?Has anyone else had any luck with other chipsets used on other PCI Parallel Port cards?And thanks free_electron and Jeroen3, but special thanks for the original Winio coder and oPossum for actually getting something to work!..Still Portless in Seattle

author: oPossum
author_rank: Super Contributor
timestamp: May 03, 2015, 12:57:24 am
content: Are you able to write to the port and see the data outputs change?Here is a VB.NET program that will display the status, control, and data registers continuously. Be sure to edit it for the base address of your parallel card.The status inputs have pullup resistors, so shorting one of them to ground should show a change.Some ports will do the same with the control lines.Note that some signals are inverted so they show 0 when pulled high, and will change to 1 when grounded.Should look like the attached screen capture when idle.Code:Option Strict OnImports System.Runtime.InteropServicesImports System.ThreadingModule Module1<DllImport("kernel32.dll")> Public Function LoadLibrary(ByVal name As String) As IntPtrEnd Function<DllImport("kernel32.dll")> Public Function FreeLibrary(ByVal handle As IntPtr) As BooleanEnd Function<DllImport("kernel32.dll")> Public Function GetProcAddress(ByVal handle As IntPtr, ByVal name As String) As IntPtrEnd Function<UnmanagedFunctionPointer(CallingConvention.StdCall)>Delegate Function InitializeWinIoType() As Boolean<UnmanagedFunctionPointer(CallingConvention.StdCall)>Delegate Sub ShutdownWinIoType()<UnmanagedFunctionPointer(CallingConvention.StdCall)>Delegate Function GetPortValType(ByVal PortAddr As UInt16, ByRef pPortVal As UInt32, ByVal Size As Byte) As Boolean<UnmanagedFunctionPointer(CallingConvention.StdCall)>Delegate Function SetPortValType(ByVal PortAddr As UInt16, ByVal pPortVal As UInt32, ByVal Size As Byte) As BooleanSub Main()Console.WriteLine("{0} bit", IntPtr.Size * 8)Dim winio As IntPtrIf IntPtr.Size = 4 Thenwinio = LoadLibrary("WinIo32.dll")ElseIf IntPtr.Size = 8 Thenwinio = LoadLibrary("WinIo64.dll")ElseConsole.WriteLine("Unsupported system")Exit SubEnd IfConsole.WriteLine("WinIo DLL Module Handle: {0:X}", winio)If winio = IntPtr.Zero ThenConsole.WriteLine("WinIo library could not be loaded")Exit SubEnd IfDim fp As IntPtrfp = GetProcAddress(winio, "InitializeWinIo")If fp = IntPtr.Zero ThenConsole.WriteLine("Could not get address of InitializeWinIo")FreeLibrary(winio)Exit SubEnd IfDim InitializeWinIo As InitializeWinIoType = DirectCast(Marshal.GetDelegateForFunctionPointer(fp, GetType(InitializeWinIoType)), InitializeWinIoType)fp = GetProcAddress(winio, "ShutdownWinIo")If fp = IntPtr.Zero ThenConsole.WriteLine("Could not get address of ShutdownWinIo")FreeLibrary(winio)Exit SubEnd IfDim ShutdownWinIo As ShutdownWinIoType = DirectCast(Marshal.GetDelegateForFunctionPointer(fp, GetType(ShutdownWinIoType)), ShutdownWinIoType)fp = GetProcAddress(winio, "GetPortVal")If fp = IntPtr.Zero ThenConsole.WriteLine("Could not get address of GetPortVal")FreeLibrary(winio)Exit SubEnd IfDim GetPortVal As GetPortValType = DirectCast(Marshal.GetDelegateForFunctionPointer(fp, GetType(GetPortValType)), GetPortValType)fp = GetProcAddress(winio, "SetPortVal")If fp = IntPtr.Zero ThenConsole.WriteLine("Could not get address of SetPortVal")FreeLibrary(winio)Exit SubEnd IfDim SetPortVal As SetPortValType = DirectCast(Marshal.GetDelegateForFunctionPointer(fp, GetType(SetPortValType)), SetPortValType)If Not InitializeWinIo() ThenConsole.WriteLine("Error initializing WinIo driver")FreeLibrary(winio)Exit SubEnd IfConst port_base As UInt32 = &HD880Const data_port As UInt32 = port_base + 0Const status_port As UInt32 = port_base + 1Const control_port As UInt32 = port_base + 2SetPortVal(control_port, &H4, 1)Console.Clear()Console.SetCursorPosition(0, 0)Console.WriteLine("S7 S6 S5 S4 S3 C3 C2 C1 C0 D7 D6 D5 D4 D3 D2 D1 D0 Register Bits")Console.WriteLine("11 10 12 13 15 17 16 14 1 9 8 7 6 5 4 3 2 DB25 Pins")DoDim status As UInt32Dim control As UInt32Dim data As UInt32GetPortVal(status_port, status, 1)GetPortVal(control_port, control, 1)GetPortVal(data_port, data, 1)Console.SetCursorPosition(0, 2)Console.WriteLine(" {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13} {14} {15} {16}", _(status >> 7) And 1, _(status >> 6) And 1, _(status >> 5) And 1, _(status >> 4) And 1, _(status >> 3) And 1, _(control >> 3) And 1, _(control >> 2) And 1, _(control >> 1) And 1, _control And 1, _(data >> 7) And 1, _(data >> 6) And 1, _(data >> 5) And 1, _(data >> 4) And 1, _(data >> 3) And 1, _(data >> 2) And 1, _(data >> 1) And 1, _data And 1)Thread.Sleep(20)Loop While Not Console.KeyAvailableConsole.ReadKey()ShutdownWinIo()FreeLibrary(winio)End SubEnd Module

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 03, 2015, 01:53:07 am
content: GigaThanx, oPossum,it works!I discovered two problems with my PCI card:Firstly, the old parallel cable had all the parallel pinout spec'd ground pins connected together at the Centronics connector end end, but they did not connect to a I/O ground point of the PCI card, only the shield wire of the DB25 wired cable was connected to ground. Connecting these two grounds together allowed me to view and change logic levels on the ports.Secondly, I presumed that the PC's back panel DB25F of this 2-ported PCI Parallel Port Adapter was LPT2..it was in fact, LPT3 and when I changed logic levels at the connector and then input from the corrected ports, (base address 0xDF90)..everything works!It turns out the interior bed-of-nails male connector located on the PCI PCB is used for LPT2.Thirdly, using inpout32.dll, I attempted to debug the program and access port addresses that were used by the target PCI card which was not installed on the desktop with the VB6 or VS@010 compilers, and so I got a VB6 IDE crash, but the compiled .exe program worked fine on the target PC.I also got my VB6 version of this access idea working using Inpout32.dll, X86 only and it also lacks the excellent error X86/X64 checking and .dll operation diagnostics and Win7 compatibility..oPossum, you did some excellent work!

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 03, 2015, 02:36:18 am
content: Thanks Mechatrommer, your explanation was most helpful to understand the importance of programs having a few manners when playing with Windows private ports.Thanks again to all that posted, and to Suicidaleggroll and Jeroen3 and Janoc."Thanks free-electron..you say correctly, I assume, that, "SO : PCI is not mapped in Io space but in main memory space."but WiNDOWS assigns the PCI Parallel Ports, so they seem to be ports, functionally identical to legacy ports, but these 0xDFxx ports do exist!(if only emulated?)