Hi,
I want to create a form with an input-field.
In this field the user can enter an address
an a data byte. My question is how to read
the data from the input-field and send it
to my development kit(EZ-USB FX). Below you’ll find
a part of my program:
void __fastcall TForm1::Button5Click(TObject *Sender)
{
BULK_TRANSFER_CONTROL bulkControl;
UCHAR outBuffer[64];
WORD outPacketSize;
UCHAR inBuffer[64];
WORD inPacketSize;
unsigned long nBytes = 0;
int i;
char read;
BOOL success;
char str[10];
bulkControl.pipeNum = 1;
outPacketSize = 64;
// Clear Buffer
for(i = 0; i < 63 ; i++)
{
outBuffer[i] = 0;
}
outBuffer[0] = data; // This needs to be the inputdata
success = DeviceIoControl (handle,
IOCTL_EZUSB_BULK_WRITE,
&bulkControl,
sizeof(BULK_TRANSFER_CONTROL),
&outBuffer[0],
outPacketSize,
&nBytes,
NULL);
if(success == TRUE)
{
sprintf (str, "Write succeeded: 0x%02X nbytes: 0x%02X", outBuffer[20], nBytes);
Memo1->Lines->Add(str);
}
}
If it isn’t clear what I want to do, please ask
kind regards,
Chris