How to Programmatically Detect USB-8451 I2C/SPI Interfaces Hardware: Instrument Connectivity Other
Problem: How can I programmatically determine if a USB-8451 is connected to my computer? Solution: The USB-8451 is a VISA Resource and appears in Measurement & Automation Explorer (MAX) in the USB Devices section. It is assigned a standard VISA resource descriptor. This allows you to use the VISA Find Resources VI in LabVIEW to determine if the USB-8451 is present in the system. A sample of the resource descriptor for a USB-8451 device is seen below: VISA Resource Descriptor for USB-8451 Device USB0::0x3923::0x7166::0010AE74::RAW The fourth component in this resource descriptor (0010AE74 in the example above) is the device serial number, so you need to ignore this when searching for resources. You also want to allow the flexibility for the device to be found on another USB interface, so we want to ignore the 0 in the first section of the resource descriptor. To do this, you should use the following string, where the "?*" represent an unknown sequence of characters: Search expression to locate USB-8451 devices USB?*::0x3923::0x7166::?*::RAW The figure below illustrates how the VISA Find Resource VI can be used to locate USB-8451 devices. The output is an array of strings, so it will be necessary to index the array to select the desired USB-8451 if more than one if present on the system. The return count output can be used to easily determine if a device was located in the system. ![]() Using the NI-845x drivers to search for installed devices Besides the VISA functions the NI-845x driver offers native functions to search for installed devices. These functions are written in C and were converted into shared librarys (DLLs). Please look at the attached LabVIEW vi. See related field for how to Access USB 845x API functions from a C program. Related Links: KnowledgeBase 3VMGBS5N: How Do I Access My 8451 From LabVIEW? KnowledgeBase 4DBCH31S: How to Access USB-845x API Functions from C Program? Attachments:
Report Date: 04/11/2006 Last Updated: 01/30/2008 Document ID: 3WADAH2W |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

