LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I read and write to the USB port?

Using CVI how do I read and write to a usb port?



0 Kudos
Message 1 of 3
(8,371 Views)
USB isn't like an RS-232 comms port - conceptually, you don't read from and write to a port; you read from and write to a device that is connected to a port (perhaps indirectly through a hub).
 
By far the easiest way to do this is to install the device manufacturer's USB driver (if there is one). If you are lucky, the device uses a standard driver interface (e.g. it might appear as a virtual comms port). Alternatively, the manufacturer may provide you with a custom programming interface that is typically a number of function calls accessed through a DLL, ActiveX control or .NET assembly. If there is a custom programming interface, the manufacturer will have documented it (somewhere).
 
Alternatively, the NI VISA software includes a generic USB driver that can be configured to read and write to any device. But this is an extremely low-level programming interface - you have to know exactly the endpoints and protocols that the USB device uses as well as more obvious things like the vendor and device ID.
 
If you are really ambitious or you are developing your own device, you would be considering writing your own device driver (not a job for the faint-hearted).
 
What are you trying to do?
 
--
Martin
Certified CVI Developer
Message 2 of 3
(8,349 Views)
Yes, Visa is good and simple to use, but I recently moved to using libusb.
The advantage is that you can also move your driver to Linux.
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 3 of 3
(8,322 Views)