3

私は USB の約 4 本のワイヤーを知っています!私はそれらに取り組みたいと思っています。私はwindows7を使用しています。

cを使用してワイヤーを介して信号(デジタルのバイナリである可能性があります)を制御したい!キーボードの 4 つの矢印キーで車を運転したい !

主なアイデアは、USBの4本のワイヤーを車のリモコンに接続することです。矢印キーを押すと、オン/オフ信号が特定のワイヤーに送信され、押すとforward リモートコントローラーは forward コマンドを取得し、車に送信して車を動かします。

基本的に、USBをCプログラムに接続して特定のコマンドで指示する以外のすべての準備ができています

6 つのコマンドを機能させたい。

  1. 前方
  2. 後ろ向き
  3. 右 n 前方
  4. 右 n 後方
  5. 左n前方
  6. 左 n 後方

助けてください!1!これは私を殺しています!

4

3 に答える 3

3

USB ports on modern computers cannot be manipulated directly in the manner that you are describing, because the processor is not accessing those wires directly. There is a dedicated host controller chip that does most of the job, usually one implementing one of the various Host Controller Interface specifications. That chip handles the low-level handshaking with the various devices and may just refuse to work with a port that does not have a proper USB device connected.

The main CPU accesses the USB port by programming the host controller, which imposes several restrictions on what can and cannot be done. In addition, all major operating systems that I am aware off have a pretty rigid interface for accessing USB ports. Even if the HCI allowed direct signal manipulation of the USB port, the OS interface does not.

Finally, wiring random non-USB-compliant hardware to the USB port is a very good way to fry the port and possibly the computer. USB is intended to be implemented by both the computer and the device.

If you want to control hardware with the USB port, then you could either use an adapter to another port interface (e.g. a parallel port) or incorporate a microcontroller that supports USB connectivity in your car controller.

于 2013-03-03T08:49:27.597 に答える
0

問題は解決しました。L293D IC を LAN ワイヤで使用し、シリアル ポートを介して Windows 98 PC に接続しました。

それは私のために働いた。ご協力いただき、ありがとうございます。

また、大学で最高のプロジェクトを受賞しました。

于 2013-12-22T10:46:22.497 に答える
0

アセンブリの学習を試すことができます。

私の記憶が正しければ、2 つの引数 1. ポート番号 2. 送信するデータを渡すだけで、「out」と書き込んで、そのデータをそのデバイスに送信します。

低レベルCでもほぼ同じです。私が意味をなさないかどうか尋ねてくださいうまくいけば私は助けました.

編集申し訳ありませんが、当時は経験がなかったので、私の答えはまったく役に立たず、間違っています。

于 2013-11-17T23:40:02.033 に答える