Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Parallel port acces with inpout32.dll

Author
Message
Balagrius
17
Years of Service
User Offline
Joined: 23rd Nov 2006
Location: Romania
Posted: 24th Nov 2006 00:15 Edited at: 9th Dec 2008 17:42
"Writing programs to talk with parallel port was pretty easy in old DOS days and in Win95/98 too. We could use Inporb and outportb or _inp() or _Outp functions in our program without any problem if we are running the program on DOS or WIN95/98. But entering to the new era of NT clone operating systems like WIN NT4, WIN2000, WINXP, all this simplicity goes away. Being interested in Parallel port interfacing and programming you might have experienced the problems in writing a program that can talk to parallel port successfully in NT based operating systems. When we are trying to run a program which is written using the conventional software functions like Inporb, outportb, _inp() or _Outp on a WINNT or WIN2000 system, it will show an error message that "The exception privileged instruction occurred in the application at location ....". Being a very secure operating system, Windows NT assigns some privileges and restrictions to different types of programs running on it.It classifies all the programs in to two categories , User mode and Kernel mode ie; running in ring3 and ring0 modes. user mode programs are running in ring3 mode and Kernel mode programs are running in ring0 mode. The programs you generally write falls in the user mode category. The user mode programs are restricted to use certain instructions like IN, OUT etc.. Whenever the operating system find that a user mode program is trying to execute such instructions , the operating system stops execution of those programs and will display an error message. Eventually our interfacing programs stops where they are executing IN or OUT instructions to read or write data to parallel port. But in the same time Kernel mode programs are in no way restricted in executing such instructions. Device drivers are capable of running in kernel mode. So the work around for the above stated problem is to write a kernel mode driver capable of reading and writing data to parallel port and let the user mode program to communicate with it. Writing a driver is not an easy job for even experienced programmers. But writing a simple driver for communicating with parallel port is a simple task when drivers like USB, sound card etc.. are concerned. Even though you get a working driver from somewhere else, installing and configuring it can be very cumbersome task.
Introducing Inpout32.dll for WIN 98/NT/2000/XP. This dll have the following features
1) Works seam less with all versions of windows (WIN 98, NT, 2000 and XP)
2) Using a kernel mode driver embedded in the dll
3) No special software or driver installation required
4) Driver will be automatically installed and configured automatically when the dll is loaded
5) No special APIs required only two functions Inp32 and Out32
6) Can be easily used with VC++ and VB" , but DBP ?
i've made this program

&h378 is the address of LPT1 and &h55 the value that we're writeing to the port
i've also tryed with address in int 888, and a value form 0-255 but keeps comeing with errors
and i'm receiveing this error "Array does not exist or out of bounds" ... does anybody know why?

if you think you can ... or not.. both ways.. you're right
CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 24th Nov 2006 01:27
not sure but I have serial port plugin on my [href]dbp page[/href]

its called SerialPortMulti if you want to give it a try.

Ekko
19
Years of Service
User Offline
Joined: 27th Apr 2004
Location:
Posted: 24th Nov 2006 10:52
Heh, were working on the same thing at the same time... I even have my bread board out with leds on it . I have never used the dll commands in dbp, just never had to nor wanted to, so I started a dll in cpp making some third party commands to run the Inpout32.dll in dbp, that way I would have it feel more like a built in dbp command set. Please keep posting your progress with this issue, and I'll also update you with my progress.
Ekko
19
Years of Service
User Offline
Joined: 27th Apr 2004
Location:
Posted: 24th Nov 2006 11:02
and here you go...problem solved!
Balagrius
17
Years of Service
User Offline
Joined: 23rd Nov 2006
Location: Romania
Posted: 27th Nov 2006 16:55
ok, i've changed my dll with this one and with this code works


and i've just discovered how to read data like this

you can see x values when you ground 2 pins with a wire

if you think you can ... or not.. both ways.. you're right

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-24 02:12:53
Your offset time is: 2024-04-24 02:12:53