Can someone point me to examples of doing IO to Serial Ports in a Windows XP environment?


Posted on 2004-05-18 14:38:34 by firmo
Posted on 2004-05-18 15:16:25 by f0dder
Hi FOdder,

I did read that FAQ and went to Thomas website. However he has a lib for an old version of WinIo that does not work for WinXP.

I sent him an e-mail and am hopping he will reply> I dont know f his e-mail address is istill valid.

But thanks for the reply.


Posted on 2004-05-18 15:28:48 by firmo

Try Porttalk v2.0 from beyondlogics
Posted on 2004-05-18 15:36:19 by KSA
Here's the XP-compatible WinIO files which I have used and can confirm there is no problem..
Posted on 2004-05-19 03:03:45 by Homer
Thanks KSA and EvilHomer2k,

Will look at both.


Posted on 2004-05-19 10:25:52 by firmo
Hi EvilHomer2k,

Could you inform the version of WinIo that the file you sent me are from?


Posted on 2004-05-20 14:40:25 by firmo
According to the DLL information, it's 2.0
Posted on 2004-05-24 01:10:09 by Homer
Hi EvilHomer2k,

Thanks again.

However I have another question regarding the PROTOS you sent me for the WinIo routines.

The PROTOS define all the parameters as DWORD and looking at the defined parameters in WinIo documentation some of them are not.

For example:

bool _stdcall GetPortVal(
WORD wPortAddr,
PDWORD pdwPortVal,
BYTE bSize


Forgive the beginner question but I thoght the parameter types had to match. If they dont how does the calling routine unstack them if it is expecting different size types?


Posted on 2004-05-24 11:39:38 by firmo
I only whant to add other resource, finded by other person here (@ this computer), but that need access the serial port http://www.logix4u.net/

Have a nice day or night
Posted on 2004-05-24 13:16:39 by rea
Thanks hgb.

Posted on 2004-05-24 13:37:44 by firmo
Of course you are correct about the Params of functions, but are you sure the documentation matches the version I provided? Attached is a working example for a machine automation application (robotics) which I wrote a while ago with the WinIO files I provided (source provided is not my final version).. you can mess with the pins on the printer port in realtime and see the bits changing in one part of the application (press escape and find Expert Mode)

Don't expect too much from the source I provided, I just wanted to prove beyond doubt that the WinIO files provided are ok, and that the params specified for this version are correct.
Posted on 2004-05-25 00:51:02 by Homer
Hi EvilHomer2k,

Thanks for the files. I will study them with care.

Thomas Bleeker <Thomas@MadWizard.org> provided me with a very nice explanation on how the PROTOS are the way they are. I reproduce his explanation below since it will benifit a lot of us:

"In high level languages like C++ parameters always have to have the right types because the compiler enforces the use of the right type with type checks. However, in assembly there are almost no types, only the processor's types (DWORD, WORD, BYTE, etc). A pointer is just a DWORD, and so is an integer.

Then there's something else that confuses things, namely that in windows, all function paramters are passed as DWORDs or multiples of that. You will never see a 16-bit register or something pushed onto the stack as a parameter to an API call or C function. This is because the stack needs to be aligned to 4 byte boundaries and because it's far more efficient to use DWORDs.

In this paricular case it means that WORD, PDWORD and BYTE are all passed as DWORDs in the end anyway. If the size of the type is smaller (like WORD and BYTE) it is stored in the lowest bits of DWORD and only part of it is used (for example only the lowest 16-bits in the case of a WORD). Sometimes it is also assumed the unused bits are zero but this might be a wrong assumption in some cases.

Some people define typedef's for other types (like PDWORD typedef DWORD), but since most prototypes are generated automatically usually just DWORD is used.

Posted on 2004-05-25 09:43:06 by firmo