PC側ソフトはボタンを2つ追加して、クリックされた時に
0x82、0x83 のコマンドを送るようにしただけです。
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { ULONG BytesWritten = 0; unsigned char OutputPacketBuffer[64]; OutputPacketBuffer[0] = 0x82; WinUsb_WritePipe(MyWinUSBInterfaceHandle, 0x01, &OutputPacketBuffer[0], 64, &BytesWritten, NULL); } private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) { ULONG BytesWritten = 0; unsigned char OutputPacketBuffer[64]; OutputPacketBuffer[0] = 0x83; WinUsb_WritePipe(MyWinUSBInterfaceHandle, 0x01, &OutputPacketBuffer[0], 64, &BytesWritten, NULL); }
PIC側ソフトはコマンドに応じた処理を追加しただけです。
case 0x82: TRISB = 0xFC; // RB0,1 output LATBbits.LATB0 = 1; LATBbits.LATB1 = 1; break; case 0x83: TRISB = 0xFC; // RB0,1 output LATBbits.LATB0 = 0; LATBbits.LATB1 = 0; break;
0 件のコメント:
コメントを投稿