how to control dc motor using the USB port by binary values ? (without using controller or processor) for simple start stop operations only?
古いコメントを表示
we are inneed of command for usb port enable or disable by using binary value withuout using controller or external hardwares
回答 (1 件)
Walter Roberson
2018 年 2 月 5 日
0 投票
That is not possible. USB is a serial packet protocol that uses differential lines. The USB controller hardware has a microcircuit to do the direct control of the lines and the lines cannot be directly addressed. You cannot use USB to send a single binary value except by using the USB port to talk to a device by sending it commands to trigger the values on your behalf -- requiring external hardware. For example a USB parallel port.
4 件のコメント
Prasanna Rajan
2018 年 2 月 5 日
編集済み: Prasanna Rajan
2018 年 2 月 5 日
Walter Roberson
2018 年 2 月 5 日
USB ports use packetized commands -- similar to using ethernet in data structures. USB cannot hold a value or a bit: the data is bundled with headers and sent over USB and you need some kind of device to decode it into hardware signals. If you were to try a USB to RS232 or USB to TTL, then note that both RS232 and TTL serial do not permit the transmit lines to be held. A true RS232 port would permit RTS or DTR to be held, but the USB emulation of those has to send the state of those pins as digital data and the decoding device needs to somehow be constructed to hold the state.
USB to R232 or TTL, or USB to parallel cannot sustain low latency because of the master/slave polled protocol inherent to USB.
If you must use USB, then I would suggest you consider putting a Raspberry Pi or Arduino at the other side to manage the motor control; if you needed a lower latency or higher frequency than could be handled by USB ports themselves, you would build a waveform description of some sort to send to the Pi or Arduino to decode and handle the sending as required.
Prasanna Rajan
2018 年 2 月 5 日
Walter Roberson
2018 年 2 月 5 日
See https://www.mathworks.com/help/matlab/matlab_external/overview-of-the-serial-port.html#f51533 . You can configure the state of the DTR pin using the serial object DataTerminalReady property; see https://www.mathworks.com/help/matlab/matlab_external/overview-of-the-serial-port.html#f51533 . This pin has only two states and is not at all suitable for PWM (Pulse Width Modification)
You have not said anything the frequency (number of times per second) you need to change the motor, or about your latency requirements (how long between the time something happens that requires a change of state, to the time the state is actually changed.) Setting the DTR pin is not intended to be used for signalling. I would not trust being able to change the state more than 2 or 3 times per second, not without testing.
コミュニティ
その他の回答 パワー エレクトロニクス コミュニティ
カテゴリ
ヘルプ センター および File Exchange で Serial Port Interface についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!