How can I communicate with a USB instrument which is not VISA?
9 次查看(过去 30 天)
显示 更早的评论
I need to control a USB stepper motor controller which is not a VISA instrument. How can I use USB without VISA?
0 个评论
采纳的回答
Walter Roberson
2018-8-27
USB devices can often be opened as serial ports. If the device does not support VISA, then you will need to research the protocol.
If it is a line-oriented protocol then matters are often not so bad, but even with line oriented protocols, some devices have a fairly complicated command structure.
Some USB devices communicate with fixed length binary packets but still compatible with serial drivers. Sometimes the interfaces for these are fairly simple and sometimes the interface can get fairly complicated.
This approach requires that the device be willing to communicate with RS232 or TTL emulation. This approach does not work if the USB device registers itself as an audio or video device, or as a bulk data device (e.g. like a disk drive.) It is not possible to communicate directly from MATLAB to arbitrary USB devices: to work with such devices you need code that talks to the USB controller, giving USB controller commands and retrieving results, which requires a binary packet structure that cannot be created at the MATLAB level.
MATLAB also does not support any way of sending the USB controller a "push" packet, which effectively limits the number of back and forth serial interactions per second, as the USB drivers will wait for a while assuming that more serial data might arrive, only dispatching the packet when it fills up or a timeout occurs. The serial flush operation supported by MATLAB does not force the data to be sent: the serial flush operation is to remove any pending output from the output buffer.
9 个评论
Walter Roberson
2018-8-29
The GUI interface you were using should, I think, tell you which COM port is in use. Devices of this variety report their type as Communications devices, and implement "serial over USB". Serial over USB is close to being a raw stream of bytes presented as packets, but each packet also starts with a few bytes of emulated pin statuses like DTR.
更多回答(1 个)
Nanda Gupta
2018-8-27
I understand that you are trying to use USB Stepper Motor Controller with MATLAB. Unfortunately, Instrument Control Toolbox does not support USB devices without VISA interface as mentioned in the following documentation link for USB devices and Support for Instrument Control Toolbox:
One other way to communicate with this instrument could be to have an intermediate device that is supported by MATLAB and configure this device to talk to the stepper motor and MATLAB. Please note that this might just be one of the possibilities.
3 个评论
Nanda Gupta
2018-8-27
Yes, Arduino could be one such intermediate device. The technical support can not quote as to why USB without VISA is not supported. However, if you have DLLs in C routine, you can use this with the help of 'loablibrary' function in MATLAB. The following link talks more about the same:
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Hardware Discovery and Setup 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!