필터 지우기
필터 지우기

How can I communicate with a USB instrument which is not VISA?

조회 수: 14 (최근 30일)
I need to control a USB stepper motor controller which is not a VISA instrument. How can I use USB without VISA?

채택된 답변

Walter Roberson
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
Patrick Johnston
Patrick Johnston 2018년 8월 29일
WOW! Thanks! I take it that COM3 is somehow attached to the USB hardware... I won't get a chance to test this until, probably, tomorrow, but thank you, Mr. Roberson!
Walter Roberson
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
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
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:
Walter Roberson
Walter Roberson 2018년 8월 28일
In turns out that Arduino is not required for this particular device.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Test and Measurement에 대해 자세히 알아보기

태그

제품


릴리스

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by