Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Changed OS to W2K, now cannot read serial port on PC from existing application.

I have three instuments that each have a PC connected to the controller's serial port. The PC's were recently upgraded to Windows 2000. The C application on each machine worked until the upgrade to W2K. Now the C app does not successfully read input from the serial port. I have verified using HyperTerminal that data is being sent from the instrument controller.

Is there a library I need to upgrade on the PC for W2K?
If so, what is it called and where is it located on the PC?

I apologize for my ignorance; I am not the support person for these apps and the support person is away at this time.
0 Kudos
Message 1 of 4
(3,555 Views)
How old is your application? If the application is an old DOS application or Win 95/98 application that is making direct port I/O calls (instead of win32 calls - createfile, etc.) the application will not work under NT systems. Windows 2000, XP, etc. does not allow applications to address memory reserved for the kernel (including port I/O).
0 Kudos
Message 2 of 4
(3,555 Views)
The application was first written about 8 years ago, I believe. So your assessment sounds correct.

The following statement is used to configure the com port:
"OpenComConfig (1, 2400, 2, 7, 1, 512, 512, 0x3F8, 4)"
The format of it does not correspond with the latest documentation I have seen, and it uses the com port address specifically, so this must be the problem.
Is it as simple as replacing the above statement with:
"OpenComConfig (1, "COM1", 2400, 2, 7, 1, 512, 512)" and recompiling the application?

Again, I apologize for being ignorant, but can you outline a few steps I would have to perform to make the application work in W2K? I have all the source code, thankfully.
0 Kudos
Message 3 of 4
(3,555 Views)
It won't be as simple as getting rid of the hex address (that is the I/O address of one of the com ports). However, since you do have the source code, you may be in luck. There are some 3rd party utilities and libraries that folks are using to covert old serial applications to work under NT. Check out http://www.internals.com/ and the WinIO library as an example. Here is what that web site says:

Under Windows NT/2000, user mode applications are completely prohibited from accessing I/O ports. Any attempt to access an I/O port from a ring 3 application is terminated with a protection fault. Thus, the only way to overcome this limitation is by using a kernel-mode device driver, such as the one supplied with the WinIo library.


I've not actually compilied with this library, but it looks like it should do the trick. Make sure you read through all of the documentation! Good luck, and let us know how it goes!
0 Kudos
Message 4 of 4
(3,555 Views)