J
john
Hello,
I am trying to send 2^19 data to USB2.0. I am reading the file
"all_sines" and loading it into
an array called "string1". Then, in a for loop I copied it into the USB
data array "Data_outBuffer". The USB can
carry only "32767" bytes at one time. The way I am doing right now
requires 16 for loops to send the
2^19 amount of data. ( 32767 * 16 = 2^19). My USB function SetSignals
can only carry "32767 bytes at one time".
I am looking for optimize code solution. like one while loop and the
other for loop.
Thanks
Regards,
John
#define COUNT_VAR 32767
int main(int argc, char* argv[])
{
FILE *infile;
unsigned char string1[COUNT_VAR+1];
unsigned char DataOutBuffer[COUNT_VAR -1];
int ReturnVal;
int x;
if ( (infile=fopen("C:\\C\\all_sines.bin","rb")) != NULL )
{
fread ( string1,sizeof( char), COUNT_VAR, infile );
}
else
printf( "Problem opening the file\n" );
for( x=0; x <= COUNT_VAR-1 ; x++ )
{
DataOutBuffer[x]=string1[x];
printf("value =%d %d\n",x,DataOutBuffer[x] );
}
SetSignals (PodNumber, 0xFF /* Don't Care */, COUNT_VAR /*Max.
Length=32767*/, DataOutBuffer); // USB Command
}/*main*/
I am trying to send 2^19 data to USB2.0. I am reading the file
"all_sines" and loading it into
an array called "string1". Then, in a for loop I copied it into the USB
data array "Data_outBuffer". The USB can
carry only "32767" bytes at one time. The way I am doing right now
requires 16 for loops to send the
2^19 amount of data. ( 32767 * 16 = 2^19). My USB function SetSignals
can only carry "32767 bytes at one time".
I am looking for optimize code solution. like one while loop and the
other for loop.
Thanks
Regards,
John
#define COUNT_VAR 32767
int main(int argc, char* argv[])
{
FILE *infile;
unsigned char string1[COUNT_VAR+1];
unsigned char DataOutBuffer[COUNT_VAR -1];
int ReturnVal;
int x;
if ( (infile=fopen("C:\\C\\all_sines.bin","rb")) != NULL )
{
fread ( string1,sizeof( char), COUNT_VAR, infile );
}
else
printf( "Problem opening the file\n" );
for( x=0; x <= COUNT_VAR-1 ; x++ )
{
DataOutBuffer[x]=string1[x];
printf("value =%d %d\n",x,DataOutBuffer[x] );
}
SetSignals (PodNumber, 0xFF /* Don't Care */, COUNT_VAR /*Max.
Length=32767*/, DataOutBuffer); // USB Command
}/*main*/