APIs in the Kernel32.dll for Port I/O

I have the serial I/O going gang busters. I have this thought thatI could use the parallel port for some interesting stuff as well.So, I...er...um... actually Google found that support.microsoft.comhas this section called:

HOW TO: Access Serial Ports and Parallel Ports by Using MicrosoftVisual Basic .NET

Now, I'm using these same kernel32 calls for my serialI/O...HOWEVER in that section:

About 1/3 of the way down in the section:Retrieve and Modify the Control Settings, in the second block of codefor "To reconfigure LPT1, use the following code:"

There appears to be a Cut and Paste error 'cuz it describes theserial parameters again, for LPT1 !! Any way to get this correct.I ... er...um, I mean Google couldn't find other explanations onthese API calls.

Share:

3 Answers Found

I checked it out. Have you tested it yet? I read through it and I don'tsee any reason why it shouldn't work. 8N1 9600 are valid parameters forparallel as well as serial ports I think. So I wouldn't assume this codedoesn't work.

And you'll notice the handles are appropriate in the two spots -hParallelPort instead of hSerialPort, and you can see above where thesefile handles get opened - hParallelPort = CreateFile(...)

So I would say, pretend it works and see if you can get it, and reportback if you do have a problem.

And congrats - directly programming the I/O is quite an accomplishment!

Yea, I saw the handles, but they're just variable assignments...couldbe anything typed/Pasted in...still could be a Cut/Paste error asin "Oops, got the handle, but forgot to change the other DCBparameters after the paste." I did the comment thing at the bottomof the support.mSoft page & will see...Wow do you figure ("I think") those params are "valid" for 8-bitparallel where there is a strobe and different control lines?Ignored, I could believe, just to satisfy the function call parameterlist requirement. The DCB example shows no parallel port specificparams. This could be construed to mean that they have asoftware "bit-banger" (as we used to call a software UART), but thishighly unlikely-- which pins are what?. I just find it interestingthat there is always reference to serial stuff in MSDN, but this wasthe only parallel reference I found that wasn't printing specific andway over my head (not that this wasn't two weeks ago).

I did find the Platform SDK stuff, on the MSDN site, whichappears to contain all the API calls, but don't want buy for mymeager need nor download the whole API doc just for this one (andrelated) call(s)... Just a listing of the API calls in the Kernel32would be nice, though. I did "read" Kernel32 with Word, but theformat of the strings uses delimiters that can't be pasted intoWord's replace box (something Mac's Word always allowed) so Icouldn't atleast re-format and read the call names. There all jammedtogether. There also appears to be a tool to read dlls to see whatcalls are in them. The documentation should be easier, though. Thisis getting too intense for me anyway. I was hoping (and still am)that I can do it. I want to use this platform to do some up-frontwork interfacing with a speech chip on the parallel port for someblind specific SW.

Try-n-see-what-happens is an (all too common) option always, but canbe very expensive in time spent trying, trying, trying......which is what I do anyway...Then, how to set the parallel port control lines if I need some...

The one on bbs.visualbasicforum talks about a direct IN & OUTfunction in C(yuk). Is there anything like this in VBA? Memoryaddress accesses, aka Peek/Poke. I know how to do output in ASM to aPC parallel port - teach a class in basic uP for Technicians and havestudents do a "laser show"(simple image output) to one of my laserprojectors in class.