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.

Using TMS570LC43x HDK to compute the data from .txt file

Other Parts Discussed in Thread: HALCOGEN

Hello TI engineers

My project focus on use a algorithm on TMS570LC43x HDK. However, input data is stored in a .txt file. Input data is mass of data. I can not type it. And output data should also be a .txt file. How to set HALCoGen and CCS. Can you give me some advice as soon as possible? waiting online. following zip is my project.4380.Msc_project.zip

thanks!

Regards!

Xinyu

  • Xinyu,

    Use the 'C' file IO functions. Just expect that they are not going to run in realtime because w. CCS they are implemented w. breakpoints.
  • Hello Anthany Seely,

    Could you put step pictures? What are 'C' file IO functions and w?

    Thank!

    Regards!
    Xinyu
  • Hi Xinyu,

    Don't have any steps or pictures for this.

    There isn't anything special, just like any C program include <stdio.h> and use the standard file functions.

    CCS will do something called 'semihosting' where it'll remotely execute these on the file system of the host computer and
    send the data over the USB cable. But your code on the embedded system is a normal, simple C program.

    This should get you started w. testing but you'll always need the debugger attached for your program to run.

    However, if you want to do anything more than this it's a significant amount of work.

    -Anthony
  • Hi Anthany

    the following is my program main codes. Could you help me check it?
    /*this main program part for loading the matrix data*/
    float a[1][8281];
    int lines=0,r1=1,r2=8281;
    FILE *fp1;
    int i;
    fp1 = fopen("D:\study\Master project\Msc_project\c.txt", "r");
    while(lines < r1)
    {
    for(i = 0; i < r2; i ++)
    {
    if(fscanf(fp1, "%f", &a[lines][i]) == EOF)
    {
    break;
    }
    if(feof(fp1))
    {
    break;
    }
    lines++;
    }
    }
    fclose(fp1);

    /*this main program part for loading statistics algorithm*/
    int j,n,t,q[r1][r2];
    int m=0;
    for(j=0;j<r1;j++)
    {
    for(n=0;n<r2;n++)
    {
    m=0;
    for(t=0;t<r2;t++)
    {
    if(t!=n)
    {
    if(a[j][n]-a[j][t]==0)
    {
    m++;
    q[j][n]=m;
    }
    }
    }
    }
    }

    int r,k,max;
    float b[r1][1];
    for(r=0;r<r1;r++)
    {
    max=q[0][0];
    for(k=0;k<r2;k++)
    {
    if(q[r][k]>max)
    {
    max=q[r][k];
    b[r][1]=a[r][k];
    }
    }
    }

    r=0,k=0;
    float c[r1][r2];
    float d[r1][r2];
    for(r=0;r<r1;r++)
    {
    for(k=0;k<r2;k++)
    {
    d[r][k]=c[r][k];
    c[r][k]=fabs(a[r][k]-b[r][1])/401;
    c[r][k]=c[r][k]+d[r][k];
    }
    }

    r=0,k=0;
    int ecol,erow;
    float e[91][91];
    for(r=0;r<r1;r++)
    {
    for(k=0;r<r2;k++)
    {
    ecol=k%91;
    erow=k/91;
    e[ecol][erow]=c[r][k];
    }

    }

    FILE *fp2;
    int ec,er;
    fp2 = fopen("D:\study\Master project\Msc_project\out.txt","w");
    for (ec = 0; ec < 91; ec++)
    {
    for (er = 0; er < 91; er++)
    {
    fprintf(fp2, "%f ", e[ec][er]);
    }
    fputc('\n', fp2);
    }
    fclose(fp2);
    I do not understand why I can not read data from my PC.

    Thanks!

    Regards!
    Xinyu