Using NI LabWindows/CVI to Emulate USB Devices

  Print Print

"We built a graphical user interface with LabWindows/CVI to help understand USB devices as a data transfer solution for embedded consumer electronic and mobile devices like digital cameras, cellular phone, and PDAs "

- Eli Flaxer, AFEKA - The Tel-Aviv Academic College of Engineering

The Challenge:
Creating a graphical environment to emulate USB devices.

The Solution:
Using NI LabWindows/CVI to implement an emulator by C language.

Author(s):
Eli Flaxer - AFEKA - The Tel-Aviv Academic College of Engineering

From its origins in 1995, the Universal Serial Bus (USB) has gained widespread adoption for connecting peripherals to personal computers (PC). More recently, given its ease of use, expandability, high bandwidth and low cost, USB has emerged as a data transfer solution for embedded consumer electronic and mobile devices like digital cameras, cellular phone, and PDAs. Consequently, product developers are increasingly being called upon to design and implement a wide range of USB I/O devices.

We used National Instruments LabWindows/CVI to implement an emulator by C language. The project includes three C language source files. One source file includes all the functions that access the module through the parallel port, meaning, reading and writing a BYTE, setting and clearing the control bits, and reading the status bits. Another file includes functions that encapsulate several initialization functions from FTDI API library, while the third file is the emulator main module. To work with the FTDI API library the programmer should add the ftd2xx.lib file to his project and copy the ftd2xx.dll to the working directory.

In order to illustrate the emulator we built a graphical user interface (GUI)  as shown in Figure 1. As can be seen, the GUI includes 4 buses: SPP Out, SPP In, USB Out, and USB In. When setting a bit in the SPP Out  buttons the emulator read the entire eight bits and sent them, as a BYTE, to the module through the parallel port (this action emulates data sending by device to the host). In response, the host software received the BYTE and represented it on USB In indicators. When setting a bit in the USB Out buttons the host software read the entire eight bits and sent them, as a BYTE, to the module through the USB. In response, the emulator received the BYTE and represented it on SPP In indicators. (this action emulates data sending by host to the device).

Author Information:
Eli Flaxer
AFEKA - The Tel-Aviv Academic College of Engineering
218 Bney Efrayim Rd.
69107 Tel-Aviv,
Israel
flaxer@afeka.ac.il

Bookmark and Share


Explore the NI Developer Community

Discover and collaborate on the latest example code and tutorials with a worldwide community of engineers and scientists.

‌Check‌ out‌ the‌ NI‌ Community


Who is National Instruments?

National Instruments provides a graphical system design platform for test, control, and embedded design applications that is transforming the way engineers and scientists design, prototype, and deploy systems.

‌Learn‌ more‌ about‌ NI