1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
private: System::Void Run_btn_Click(System::Object^ sender, System::EventArgs^ e) {
//Variable definitions, pictureBox setup, etc.
A = false;
// For-loop
for(K = 0; K <600 && A == false; K++)
{
Application::DoEvents();
OutBuffer[0] = 0x80; //Hex 0x80h is command to send "operate/do something" code to device.
WinUsb_WritePipe(MyWinUSBInterfaceHandle, 0x01, &OutBuffer[0], 64, &BytesWritten, NULL);
WinUsb_ReadPipe(MyWinUSBInterfaceHandle, 0x81, &InBuffer[0], 64, &BytesRead, NULL);
DATAH = (InBuffer[0] << 8);
DATAL = InBuffer[1];
DATA = DATAH + DATAL;
NUMF = (DATA*ADV)/1024;
textBox2->Text = Convert::ToString(NUMF);
listBox1->Items->Add(NUMF);
g->DrawLine(blackPen, Point(J,(400*(1-NUMF/FSV))), Point(J+1,(400*(1-NUMF/FSV))));
this->textBox2->Update();
this->listBox1->Update();
this->pictureBox1->Update();
J = J + 1;
I = I + 1;
Tmr->Interval = TI;
Tmr->Enabled = true;
GC::KeepAlive(Tmr);
while(Tmr->Enabled==true)
{
;
}
Tmr->Enabled=false;
} // End of for loop
return;
} // End of Run_btn_Click
|