I would like to know, how to init and cominicate with lpt port. And if you know, speed of lpt will help me too. Thanks a lot.
Posted on 2001-09-29 03:49:35 by Risky
From what environment do you what to accomplish this from? The Win32 API Help seems to have the info for a win32 app. There are dos interupts or direct port writes (and reads on some hardware) availiable for 16b apps.
Posted on 2001-10-01 01:44:35 by eet_1024
Its tricky business... (I've been trying for years to do it thu windows... properly :) )

I've done it with a dll i got a while back... "Asmio" on Thomas' Web Page.

Its actually a "cheat" devised by some clever fellows to do some fancy things with your discriptor table... (?? dont really know more than this..), but it gets the job done. Down side is to wait for an input, you have to 'poll' input ports. SInce windows is a multi-threading OS, to poll a port will lock up all other processes of less priority.. This is BAD for the event driven model like windows. In the days of DOS this was the norm, but things change..

To get inputs, in PSEUDO real time, i redesigned the message loop a bit to use the PeekMessage API and then do a one time scan of an input port. If there is something, i call a USER DEFINED WM_INPUTDATA, and take it from there...
Down side to this is it uses up alot of cpu usage on your program. So the best fix with this is to have a globla variable to control when you should be "Peeking" and when you should be "Getting" the Message in the message loop.



Asside from this, the proper way is to write your own driver to use the parallel port. This is either Vxd or WDM (9x or NT, respectively). But i can assert these are not easy matters to tackle. There is alot of high level / low level jargin that makes it all confusing. (I gave up months ago trying the VxD's... (( might be able to hack it now tho...)) )

Anywho.. this is the facts... good luck..

I will attach my "Asmio" incase some links are dead for the .dll itself..

NaN
Posted on 2001-10-01 03:19:48 by NaN
If I remember correctly, you can open the LPT port with CreateFile ->



[pseudeo-code]
.data
szlpt db "LPT1", 0
szPrintMe db "Hello Printer!", 0
.data?
hLpt dd ?
.code
invoke CreateFile, addr szlpt, blah, blah...
mov hLpt, eax
invoke WriteFile, blahblah, addr szPrintMe, blah, blah....
[/pseudeo-code]


It's just like "copy test.txt LPT1" :)
Posted on 2001-10-01 03:47:59 by bazik