Embedded Tools
  Home arrow Embedded Tools arrow Programming Custom Hardware for Windows
Iron Speed
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Download TestComplete 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
EMBEDDED TOOLS

Programming Custom Hardware for Windows
By: Digvijay Chauhan
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 57
    2004-04-14

    Table of Contents:
  • Programming Custom Hardware for Windows
  • The Design
  • The Code
  • Points of Interest

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    Programming Custom Hardware for Windows
    (Page 1 of 4 )

    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.

    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.

    Background

    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:

    CodePDF.zip

    GiveIO.zip

    RADHWLib.zip

    More Embedded Tools Articles
    More By Digvijay Chauhan


     

    EMBEDDED TOOLS ARTICLES

    - 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...


     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway