This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TSW14J56 / to create the custom pattern from C program

Hi,

Customer has a problem for TSW14J56.

The problem with DAC is that we cannot to create the custom pattern from C program.

When we read with MS Excel text file with custom pattern that we made with C program, and the later on upload data from  this Excel file into the DAC EVM software, there is no problems.We use fput C std routine to put data into the text file. This is the code for 4 channel DAC

If  ((fp = fopen(out_file_name, "a+t")) == NULL)

    {

    printf("> WARNING: Can Not Read Data File %s...", out_file_name);

    getchar ();

    exit (0);

    }

   for (i = 0; i < N_sample; i++)

       {

       sprintf (Buff, "%d %d %d %d\n",  (int)floor(TxOrgRe[i]+0.5), (int)floor(TxOrgIm[i]),

                                                                   (int)floor(TxOrgRe[i]+0.5), (int)floor(TxOrgIm[i]));

       fputs (Buff, fp);       // put results

       }

   fclose (fp);

With Exell, We have the problem that the size of the spread sheet is limited, meanwhile we need mode sample to be send into the DAC.

If you have a sample code in C that compatible with DAC EVM software, please send us it.

Best Regards,

Kato

  • Hi Kato,

    The format of the files is very straight forward.  You can look in this directory for an example 2 column Sine and Cosine (I Q) file.  The requirement is that the file contain signed integer values from -32768 to +32767 centered at 0 value.  For csv you will need to separate the 2 column values withs commas:

    30861,-10000
    30819,10128
    18913,26356
    -273,32439
    -19354,26035
    -30985,9608
    -30688,-10517
    -18578,-26594
    683,-32433
    19682,-25788

    For .txt you can separate the 2 columns with a space.

    An example csv file is located here in the installation dir:

    C:\Program Files (x86)\Texas Instruments\High Speed Data Converter Pro\Test Files

    The example file is:

    single_tone_cmplx_32768_250MSPS__BW_25.1MHZ.csv

    Some things to keep in mind - do not use the .tsw file extension for the file name - this is reserved for encoded files that come from the GUI pattern generators designed for HSDC Pro.  Using standard .csv and txt are ok.

    I do not have a C example handy, but you can use this bit of code from my matlab scripts.  This assumes the data is already signed integer ranging from -32768 to +32767.  This creates a space delimited txt file.

    fid=fopen([filename '.txt'],'w');

    for n=1:length(enc_data)

    fprintf(fid,'%i %i\n',enc_data(n,1), enc_data(n,2)); %2 column IQ file

    end;

    fclose(fid);

    Ken