Home arrow Embedded Tools arrow Programming Custom Hardware for Windows

Programming Custom Hardware for Windows

The task of developing custom applications that access custom hardware can be daunting for even the most seasoned application developer and especially for someone who has just learned developing applications using Visual Basic and similar RAD tools. Here in this article I present an alternative way that may help even the non-programmers to do what they want. That is to develop a custom UI and then access a specific piece of hardware that is connected to their machine.

Author Info:
By: Digvijay Chauhan
Rating: 5 stars5 stars5 stars5 stars5 stars / 67
April 14, 2004
  1. · Programming Custom Hardware for Windows
  2. · The Design
  3. · The Code
  4. · Points of Interest

print this article

Programming Custom Hardware for Windows
(Page 1 of 4 )

I don't assume the reader to be aware of Port Access in Windows NT/2000/XP or even Windows 98 but I do assume that he knows what he?s trying to do. The First step would be to understand that why such a framework that allows one to support accessing hardware from RAD tools is needed and then later see what advantages it has got. Finally we would get into developing such a Framework.


Anyone who has programmed in basic and used the INPUT and OUTPUT statements would expect them to run in the Visual Basic environment too but fortunately or unfortunately it is not the case. The Visual Basic language doesn't support for direct hardware access and if the application (no matter what language is used to develop it) won't be able to access hardware directly if it's running on a secure system from the Windows NT family (i.e. NT, 2000, XP etc). These functions are crucial for PC hardware developers and programmers because they allow you to read and write to ports in environments like DOS or Windows 95 and 98. Thus without INPUT or OUPUT you can't read from or write to your device.

Fortunately the concept of dynamic link libraries or DLLs comes to rescue. DLLs allow VB to link to them (you can write a DLL in any language like Delphi, Borland C++ or Microsoft's Visual C++) during run-time (dynamically). VC++ has port I/O (input and output) read/write functions. Also VC++ compiler allows you to create DLLs apart from executable EXE files. Thus you can

  • Write VC++ code that uses these read/write functions
  • Compile it into a DLL (instead of an executable EXE file) file
  • Call your functions from VB
  • Make use of the facilities that a DLL provides; Like notifying you and providing you with a place to put your code that executes when a process loads it or unloads it.
  • Modify the DLL to make any desirable changes to the behavior of functions and you need not build the whole application again.

The list is very long and for more details on features of DLLs you can refer to DLLs, Processes, and Threads section in the MSDN library.

Now lets suppose that you're a developer willing to develop an application that needs to communicate to a hardware port, say for acquisition card, or perhaps a motor controller or even a robotic arm that you've just created! And you've never written an application that does so. Further you just have programmed in Visual Basic.

At this point the major challenges that you have are:

  • How do I access these ports?
  • What should I do so that my applications run on Windows NT family of operating systems, as they'd do on Windows 95 or 98?

I'm emphasizing on the difference between the two operating system families because they've a very different way to treat port I/O, as we'll see shortly.

So now we know that what we intend to develop and more importantly why. So let's get started!

Before you get started, you'll probably want to download the support files for this article:




blog comments powered by Disqus

- A New Toolbar Can Boost Your Web Site Traffi...
- Programming Custom Hardware for Windows
- Developing Embedded Systems - A Tools Introd...
- WAP for Fun and Profit - Part 1 - Basic WML ...
- HTTP Requesting with eVC++ 3.0 on Windows CE...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials