View Full Version : parallel port interfacing
DELOCH
02-02-2009, 09:32 PM
how can i write a function to send a number up to an integer out of a parallel port.
I have done this by downloading an io.dll from the internet and used it's function PortOut but without knowing how I can make it... it's useless.
I tried everything and end up with an unhandled windows exception.
Do I have to use windows API to accomlish such a tiny task?
i mean... how hard could it possibly be to use hardware in assembly or C... those languages were made to do this... Otherwise they have no value to me...
oracleguy
02-03-2009, 06:35 AM
Perhaps this is of some value?
http://logix4u.net/Legacy_Ports/Parallel_Port/Inpout32.dll_for_Windows_98/2000/NT/XP.html
DELOCH
02-07-2009, 01:13 AM
So the problem is that I'm in user mode?
and the only way to switch modes is somehow related to windows api?
is there any... less impossible ways?
oracleguy
02-07-2009, 04:21 AM
So the problem is that I'm in user mode?
and the only way to switch modes is somehow related to windows api?
is there any... less impossible ways?
That was a convenient wrapper DLL to access the parallel port and handles dealing with the kernel so you don't have to.
DELOCH
02-10-2009, 10:31 PM
yes, and it explains nicely how to make it, however it doesn't explain how to actually ENTER kernel mode. I want to control my hardware and what I do with my language. If it's done for me, I might as well continue coding java(which can at least make a window in 20 lines of code)...
oracleguy
02-10-2009, 11:00 PM
yes, and it explains nicely how to make it, however it doesn't explain how to actually ENTER kernel mode. I want to control my hardware and what I do with my language. If it's done for me, I might as well continue coding java(which can at least make a window in 20 lines of code)...
Not reinventing the wheel is not the same thing as using Java.
The functions that work with the parallel port, if I remember correctly are inportb and outportb but I don't think those are available in 32-bit Windows. (They are an older thing).
User code does not run in kernel mode, in order to do that, you need a device driver (or kernel API call) to bridge between kernel mode and user mode. It is annoying but that is why if you google around, there are pre-written DLLs for handling the parallel port (like the one I linked you to). Your problem is one people have ran into before.
If you had actually read the page I linked you to completely, you would have found the source code for that DLL which you could have downloaded and looked at: http://logix4u.net/inpout32_source_and_bins.zip
Beyond that, you could try seeing if the OS will let you write and read from the port directly using assembly. There are the IN and OUT assembly instructions where you give it a I/O port address and it lets you read and write to it. However the parallel port address range is probably blocked in user mode but it is worth trying.
Serial port programming however does not have this limitation and is easier to work with.
vBulletin® v3.8.2, Copyright ©2000-2010, Jelsoft Enterprises Ltd.