i'm going crazy to operate the pin of my parallel port out, i read almost all the tread in this and all web's forum....
Please tell me a guide a secret a command!
outport i understand tha's banned from windows...
also conio , partalk is impossible to use,
please also another compiler for c, that can support this!
THANKS With all of me
Davide
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
MinGW 3.4.x is not 'ancient', rather my second proposition - you included <windows.h> so 'far' is an empty macro. The fact remains you cannot access arbitrary memory locations directly for the same reason you cannot access I/O ports."
Thanks for pointing out dependency walker.
With that, I have a pole and 16 volumes on ichthyology!
Now, if I could just figure out where to hang the bait...
Of course I can't arbitrarily access memory. That's the reason for Hwinterface32 over inpout32. The problem is that documentation for the dll is a little sketchy...
I tried ReadMemLong last night, and that was the correct entry point. Unfortunately, there's no information about parameters at the logix4u Hwinterface32 page, or as far as I can tell, available from dependencywalker.
Do you know what form ReadMem*() take for the address?
Dave
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
One other note - the compiler used by Dev-C++ is GCC - the Gnu compiler.
It is not in any sense something that is related to Dev, it is a stand
alone project that has been around for years and has nothing to do
with Dev.
It is Unix'y in its ancestry, and runs on Windows through the aid of
MinGW - the version used by Dev is a couple of years old, but is only
one version older than that used by Cygwin (and MinGW) as their baseline.
It is several versions older than one commonly finds in the "current"
Linux distros - which usually have some flavor of gcc-4.x
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Perhaps you should contact the codes author to find out?
Clifford
I have, and he has now corrected and enhanced the table describing the entry points, as well as answering some of my questions.
I have it basically working, at least returning LPT1 from 0:0408, but the other two ports that are configured (as seen with debug) show up with addresses of 0, using ReadMemW32(). The sample VB program supplied with Hwinterface32.dll returns the same addresses (378, 0, 0), so either the function fails for table offsets other than 0, or this PC's virtual environment is weird. I tend to believe the latter!
Dave
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can assure you that it IS possible to directly access the parallel port with Dev-Cpp, as I've just completed a project to do just that.
The inability to directly access the parallel port pins has nothing to do with the compiler. If you're using Windows 2000 or above, you can't do it without special drivers.
Brad, this put me right on track for port access; thanks for the post!
I also have a related problem: How to find the port addresses at run time.
LPTx ports are in a table starting at 0:0408x, in base memory.
I can easily look them up with Debug, but have not been successful in reading them with a far pointer.
I've found this that should work:
(unsigned) lpt_addr = (unsigned far )(MK_FP(0x40, 0x008+(lptno*2)));
But we don't appear to have the MK_FP macro available.
Instead, I've tried:
lpt1 = (unsigned far )(((void far ) ((unsigned long)(0x40) << 16) | (unsigned)(0x008+lptno2)));
(where lptno = 2 in this case.)
That compiles and executes fine, but returns 0x04, not 0x03BC as I read from Debug.
(Oddly, this IBM "ThinkCentre" desktop has LPT1 @ 3BC, LPT2 @ 378, and LPT3 @ 278, with only LPT2 wired to the back panel.)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2007-02-20
You dug up a 5 month old thread to say thanks - where have you been! ;-)
The code you are trying to use is antique, there is no such thing as a far pointer or 'base memory' in 32bit x86, you are at least 11 years out of date! If the 'far' keyword compiled, it is because either you are using an antique 16 bit compiler, or you included a header that #defines it as empty (as it is in <windef.h>, indirectly included by <windows.h>).
The solution to this problem is on the same site that you got the I/O driver from. At http://www.logix4u.net/portaddr.htm is a DLL that includes all the functions of inpout32.dll called, plus additional ones to access memory outside the user space.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am also trying to use Dev C to write a program to send data directly to the parallel port. My program works fine in Win98, but I do not know how to use the inpout32.dll from logic4u. The example provided is not simple enough for my limited knowledge of and my preference is to use the dll directly without using pointers. At this point, I dont even know how to direct my program to use a dll.
Any guidance would be appreciated
Thankyou
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
/ IF WE REACHED HERE, INITIALIZED SUCCESSFUL ****/
and you are good to go. I would however recommend moving that initialisation code in main() into a separate function.
The advaltage of loading the library this way is that the DLL will work with any compiler (and most languages). The export libraries that make using DLL's simpler are compiler specific.
The only other thing you need do is place the dll in teh same folder as your program, or in a system path (i.e. defined by the PATH environment variable).
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1) I only recently found the forum, and discovered the 5-month ancient thread by a search.
2) The antique compiler I am using is the one supplied with Bloodshed Dev-C++, native, I thought, to this forum!
3) I think I may have gotten my DLL via a different source, although the Readme does reference logix4u.net.
This (Hwinterface32 library) has more functions than I believe are supported by the one I'm using (inpout32.dll).
What will I need to create in the way of new wrapper functions, or initialization, different from those for inpout32.dll?
Dave
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
4) There seems to be an error in the table that documents the functions in hwinterface32.dll:
ReadMemChar() Reads a single Byte from the specified memory address.
ReadMemShort() Reads a 16 bit word from the specified memory address.
ReadMemShort() Reads a 32 bit Dword from the specified memory address.
What should that last entry be? ReadMemInt? ReadMemLong?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
MinGW 3.4.x is not 'ancient', rather my second proposition - you included <windows.h> so 'far' is an empty macro. Th efact remains you cannot access arbitrary memory locations directly for the same reason you cannot access I/O ports.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i'm going crazy to operate the pin of my parallel port out, i read almost all the tread in this and all web's forum....
Please tell me a guide a secret a command!
outport i understand tha's banned from windows...
also conio , partalk is impossible to use,
please also another compiler for c, that can support this!
THANKS With all of me
Davide
Clifford wrote:
"Use a tool such as http://www.dependencywalker.com/ to find out.
MinGW 3.4.x is not 'ancient', rather my second proposition - you included <windows.h> so 'far' is an empty macro. The fact remains you cannot access arbitrary memory locations directly for the same reason you cannot access I/O ports."
Thanks for pointing out dependency walker.
With that, I have a pole and 16 volumes on ichthyology!
Now, if I could just figure out where to hang the bait...
Of course I can't arbitrarily access memory. That's the reason for Hwinterface32 over inpout32. The problem is that documentation for the dll is a little sketchy...
I tried ReadMemLong last night, and that was the correct entry point. Unfortunately, there's no information about parameters at the logix4u Hwinterface32 page, or as far as I can tell, available from dependencywalker.
Do you know what form ReadMem*() take for the address?
Dave
One other note - the compiler used by Dev-C++ is GCC - the Gnu compiler.
It is not in any sense something that is related to Dev, it is a stand
alone project that has been around for years and has nothing to do
with Dev.
It is Unix'y in its ancestry, and runs on Windows through the aid of
MinGW - the version used by Dev is a couple of years old, but is only
one version older than that used by Cygwin (and MinGW) as their baseline.
It is several versions older than one commonly finds in the "current"
Linux distros - which usually have some flavor of gcc-4.x
Wayne
Perhaps you should contact the codes author to find out?
Clifford
I have, and he has now corrected and enhanced the table describing the entry points, as well as answering some of my questions.
I have it basically working, at least returning LPT1 from 0:0408, but the other two ports that are configured (as seen with debug) show up with addresses of 0, using ReadMemW32(). The sample VB program supplied with Hwinterface32.dll returns the same addresses (378, 0, 0), so either the function fails for table offsets other than 0, or this PC's virtual environment is weird. I tend to believe the latter!
Dave
I can assure you that it IS possible to directly access the parallel port with Dev-Cpp, as I've just completed a project to do just that.
The inability to directly access the parallel port pins has nothing to do with the compiler. If you're using Windows 2000 or above, you can't do it without special drivers.
Check out inpout32 at <a href = http://www.logix4u.net/inpout32.htm>this</a> link. This is what I used and found it simple, yet effective.
Good luck!
-Brad Kartchner
Brad, this put me right on track for port access; thanks for the post!
I also have a related problem: How to find the port addresses at run time.
LPTx ports are in a table starting at 0:0408x, in base memory.
I can easily look them up with Debug, but have not been successful in reading them with a far pointer.
I've found this that should work:
(unsigned) lpt_addr = (unsigned far )(MK_FP(0x40, 0x008+(lptno*2)));
But we don't appear to have the MK_FP macro available.
Instead, I've tried:
lpt1 = (unsigned far )(((void far ) ((unsigned long)(0x40) << 16) | (unsigned)(0x008+lptno2)));
(where lptno = 2 in this case.)
That compiles and executes fine, but returns 0x04, not 0x03BC as I read from Debug.
(Oddly, this IBM "ThinkCentre" desktop has LPT1 @ 3BC, LPT2 @ 378, and LPT3 @ 278, with only LPT2 wired to the back panel.)
You dug up a 5 month old thread to say thanks - where have you been! ;-)
The code you are trying to use is antique, there is no such thing as a far pointer or 'base memory' in 32bit x86, you are at least 11 years out of date! If the 'far' keyword compiled, it is because either you are using an antique 16 bit compiler, or you included a header that #defines it as empty (as it is in <windef.h>, indirectly included by <windows.h>).
The solution to this problem is on the same site that you got the I/O driver from. At http://www.logix4u.net/portaddr.htm is a DLL that includes all the functions of inpout32.dll called, plus additional ones to access memory outside the user space.
Clifford
I am also trying to use Dev C to write a program to send data directly to the parallel port. My program works fine in Win98, but I do not know how to use the inpout32.dll from logic4u. The example provided is not simple enough for my limited knowledge of and my preference is to use the dll directly without using pointers. At this point, I dont even know how to direct my program to use a dll.
Any guidance would be appreciated
Thankyou
The example code at http://www.hytherion.com/beattidp/comput/pport/Test2.c referenced from that web site shows how to create wrapper functions around the imported functions.
You can simply copy everything from the line:
include <windows.h>
until the line
/ IF WE REACHED HERE, INITIALIZED SUCCESSFUL ****/
and you are good to go. I would however recommend moving that initialisation code in main() into a separate function.
The advaltage of loading the library this way is that the DLL will work with any compiler (and most languages). The export libraries that make using DLL's simpler are compiler specific.
The only other thing you need do is place the dll in teh same folder as your program, or in a system path (i.e. defined by the PATH environment variable).
Clifford
i hope thanks a lot!
DAVIDE
ROME
Thanks, Clifford...
1) I only recently found the forum, and discovered the 5-month ancient thread by a search.
2) The antique compiler I am using is the one supplied with Bloodshed Dev-C++, native, I thought, to this forum!
3) I think I may have gotten my DLL via a different source, although the Readme does reference logix4u.net.
This (Hwinterface32 library) has more functions than I believe are supported by the one I'm using (inpout32.dll).
What will I need to create in the way of new wrapper functions, or initialization, different from those for inpout32.dll?
Dave
Oh, I forgot to mention:
4) There seems to be an error in the table that documents the functions in hwinterface32.dll:
ReadMemChar() Reads a single Byte from the specified memory address.
ReadMemShort() Reads a 16 bit word from the specified memory address.
ReadMemShort() Reads a 32 bit Dword from the specified memory address.
What should that last entry be? ReadMemInt? ReadMemLong?
Use a tool such as http://www.dependencywalker.com/ to find out.
MinGW 3.4.x is not 'ancient', rather my second proposition - you included <windows.h> so 'far' is an empty macro. Th efact remains you cannot access arbitrary memory locations directly for the same reason you cannot access I/O ports.
Clifford
I use PortTalk22,www.beyondlogic.org,it retains the outport and inport functions,or outp and inp.
shawn
You have missed the point. He wants to access BIOS memory rather than (or as well as) I/O ports.
Do you know what form ReadMem*() take for the address?
I presume a 32bit integer representing a flat memory map address, so the segment:offset 0:0408h would simply be 0x408.
Perhaps you should contact the codes author to find out?
Clifford