Global TMW:
Login  |  Register          Free Newsletter Subscription
Subscribe
Email
Print
Reprint
Learn RSS

Get I/O Port Control With Windows NT

A free DLL lets you control simple I/O cards under Windows NT without using a card''s drivers.

Greg M. Bonaguide, Philips Semiconductors, Mansfield, MA -- Test & Measurement World, 12/1/2000

A version of this article ran in the April-May 2001 issue of Test & Measurement World. Download the pdf.

When you program a PC’s I/O ports, you often send commands to a Windows dynamic-link library (DLL). DLLs are often components of I/O card drivers, but if you just need simple I/O control, you may not want to use the complicated drivers that often come with plug-in I/O cards. Whether you should use a free downloadable DLL, direct application programming interface (API) calls, or a supplied driver depends on your operating system, your application-development language, and the computer’s expansion bus.

While developing an RF test system, I needed to control an RF synthesizer through its digital I/O (DIO) port. I wanted a DIO card that would let me program my application and begin running it as quickly as possible. My PC had both ISA slots and PCI slots available. Because I didn’t need the high bus speed or plug-and-play features of a PCI card, I selected an ISA bus card—it’s the easier card to program.

While ISA DIO cards come with drivers, the cards are so simple to control that you may not need the driver. I wanted to control the cards from Agilent VEE running under Windows NT, so I downloaded a simple PeekPoke DLL from ftp.agilent.com/pub/ mpusup/pc/binfiles/vee. On Agilent’s ftp site, you’ll find three DLLs that let you write data to (poke) or read data from (peek) a computer’s I/O port. Use the files ppoke16.exe for 16-bit Windows 3.1 applications, ppoke32.exe for 32-bit Windows 95/98 applications, and ppokent4.exe for 32-bit Windows NT systems.

When you run any of these files, they will extract their DLL components and instruction files. Once you install the DLLs, you can control your card simply by passing an I/O port address to the DLL. Then, you can read data from any port and write data to any port. Use caution; if you write data to the wrong address, you can crash your PC.

You have another option if you use an ISA card in a computer running under Windows 3.1/95/98. You can use the operating system’s application programming interface (API) function calls _inp() or _outp() to directly access an I/O port. Even so, you can’t access those functions unless you write code in C or C++. You can’t get direct API access from Agilent VEE. With Windows NT, you can’t directly control the I/O port.

Because I use Windows NT, I chose the DLL contained in ppokent4.exe to control a Keithley Instruments PIO-24 card. After following the instructions for loading the Windows NT PeekPoke DLL, I found that the PeekPoke library provides a host of I/O operations, ranging from single-byte peeks and pokes to bit-masked block-data transfers. See Figure 1 for an example of how to import and use the PeekPoke library in a VEE program.

TMW00_12T1Fig1.gif (34529 bytes)
Figure 1. You can import a DLL into a VEE program to give you direct control of your PC’s I/O ports.
 If your PC lacks ISA slots or if you like the plug-and-play features of PCI cards, then you must use the drivers supplied with your card. This is because the plug-and-play features let the system assign an address to PCI cards. Without the supplied driver, your card will never get a PCI address. T&MW

FOR FURTHER READING

Dumais, John, “Forwarding DLLs Add Functions to Existing Software,” Test & Measurement World, October 2000. p. 45.    

Freeman, Michael T., “Create Your Own ActiveX Controls,” Test & Measurement World, September 1998. p. 39. 

Greg M. Bonaguide is an RF engineer at Philips Semiconductors. E-mail: g.bonaguide@ieee.org.

Email
Print
Reprint
Learn RSS

Talkback

We would love your feedback!

Post a comment

» VIEW ALL TALKBACK THREADS

Related Content

Related Content

 

By This Author

There are no other articles written by this author.

Sponsored Links



 
Advertisement
SPONSORED LINKS

More Content

  • Blogs
  • Podcasts

Blogs

  • Rick Nelson
    Taking the Measure

    October 3, 2008
    Smoot day tomorrow
    MIT will celebrate the 50th Smoot-aversary tomorrow, Saturday, October 4. The event honors Oliver Sm...
    More
  • Martin Rowe
    Rowe's and Columns

    August 29, 2008
    LEDs, Tubes, and Clay
    The Champlain Valley (Vermont) Exhibition, which runs until August 31, has many of the usual things ...
    More
  • » VIEW ALL BLOGS RSS

Podcasts

Advertisements





NEWSLETTERS

Click on a title below to learn more.

Test Industry News (3 Times Per Month)
Machine-Vision & Inspection (Monthly)
Communications Test (Monthly)
Design, Test & Yield (Monthly)
Automotive, Aerospace & Defense (Monthly)
Instrumentation (Monthly)
Resource Center E-Alert (Monthly)
©2008 Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy
Please visit these other Reed Business sites