Example Code

USB RAW Controller

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • Instrument Control

    Software

  • LabVIEW

    Driver

  • NI VISA

Code and Documents

Attachment

Overview

These VIs illustrates control in and control out functions to a USB RAW device as results of user events. 

 

Description

It is designed to only work with USB RAW devices. For example, to get the status of a particular device, you could use the following values in a Control In function:
Request Type: 0x80 (Device to Host, Standard Type, Device Recipient)
Request: 0x00 (GET_STATUS)
Value: 0x00
Index: 0x00
Length: 0x02

 

Requirements
Software:
Labview 2012 (or compatible)
Hardware:
USB RAW device

 

Steps to Implement or Execute Code

1. Ensure USB RAW device is normally connected
2. Run the VI

 

Additional Information or References

NOTE: All controls above are configured to accept a HEXADECIMAL input. This can be changed to accept decimal values by changing the Format and Representation for each control.
The last two bits of the value returned will let you know whether the device is set to remotely wake up (bit 1), and whether the device is self powered (bit 0).
To perform control transfers with another device, close the session to the current device, select another device from the VISA resource name control, and open a session to it.
When complete, press the Stop button to end execution.

 

59.png

**This document has been updated to meet the current required format for the NI Code Exchange.**

 

Regards,
Dan King

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.