Data Acquisition (DAQ) and Control from Microstar Laboratories

Knowledge Base: Applications

Q10106 Specifying DAP hardware names in application software

Tags: Help, board names, DAP names, DAP order, UNC

Applies to: DAP, iDSC

We upgraded our host hardware and Windows software, but now our DAP boards are assigned different device names and my software doesn't find them. What can I do to fix this?

When you changed your hardware and software systems, this changed the order in which DAP devices are detected by Windows and reported to the DAPcell software. DAPcell can only name the DAP devices according to what Windows reports. This problem is not unique to DAP boards. For example, "disk letters" assigned to USB mass storage devices might be different if you plugged them in one at a time, or if you plugged them all in at once and booted the system.

When your application opens connections to the DAPcell "client-side" software (the software that interacts with application functions and supports the DAPIO32 programming interface), the DapHandleOpen function specifies which DAP to access, and the host in which that DAP is resident. The names of the DAP devices are predetermined by the Windows system and boot-time interactions with the DAPcell "server-side" software (the part that interacts with DAP devices). To get access to the right device, your application must specify a device name as assigned when the system booted.

Knowing that device names are a potential problem, you can do some things in your application coding to minimize the impact. For example, suppose the application is in C++. You can define the following header file that assigns internal "macro" names to the device names that Windows and the DAPcell server software set up.

  // DAP_name_map.h
  // Define the hardware addresses for the DAPs this application uses
  #define    DAP0_PATH    "\\\\.\\Dap0"
  #define    DAP1_PATH    "\\\\.\\Dap1"
  // End of DAP_name_map.h file

In the syntax of C++, the double-slash sequence \\ is used to represent a single backslash character in a string. The "dot" means "local host system." The macro-name DAP0_PATH is assigned a string that specifies the host system and the predetermined DAP name. After including the DAP_name_map.h header file, you can open a connection to a pipe using a DapHandleOpen function call that looks something like the following.

      hDAP0_MessagesIn = DapHandleOpen(DAP0_PATH "\\$SysOut", DAPOPEN_READ);

The C++ application will substitute the characters \\.\Dap0 for the hardware address, and then append the characters \$Sysout for the pipe address, to make a single complete string referencing the desired pipe connection. If you prefer to use various string classes rather than macro substitutions, the notations will be different but the effect should be the same.

Once you determine what the addresses are, it is easy to switch the hardware-assigned UNC addresses in the header lines to point to the correct DAP units. This isn't a perfect solution, because it still requires recompiling the application software to run on the updated system. Two alternative approaches are:

  1. Instead of coding the mapping in a header file, define the mapping in an application "config file" that is loaded when the application starts. You can edit this file to change the application behavior without recompiling the application.

  2. If reconfiguring the system software is preferable to recompiling or reconfiguring the application, see knowledge base article Q10107 .


See the DAPIO32 Reference Manual for more information about function calls and UNC notations.

Article Q10107 describes a solution using adjustments to the DAPtools software.