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.

How to generate a ccs3.3 compatible .dat file containing negative values?



Hi everyone. I'm working on a fir filter project as an end-term assignment of my DSP course.However,the negative values in the file does not read properly in ccs.What should I do to make it right?

  • Hello,

    Could you provide more details? Are you trying to create a *.dat file manually? And if so, did you create a proper header in the *.dat file?

    thanks

    ki

  • Hi,ki.

    Yes,I was trying to generate a .dat file manually through matlab using fprintf function.Look at the scripts below:

    fid=fopen(FileName2,'w');

    fprintf(fid,'1651 2 %d 1 %x\n',5000,len);

    fprintf(fid,'%d\n',RawData);

    fclose(fid);

    which "RawData" is the original data and "len" is the length of the original data.

    Since fprintf function only support 10-based signed numbers.If it goes to 16-based number,it could only be unsigned.However,in CCS,data types supported in Graph tool are 16 or 32 based numbers.So I can't sure whether it's appropriate to write decimal numbers while they're read in hexadecimal ways.

    I tried generate a .dat file containing a sine wave @1500Hz matlab using functions above,but when I looked in CCS graph tool(FFT magnitude),with parameters set correctly,it shows it's @1000Hz.So I don't know if it's right to write in decimal ways.

    Thanks.

  • Hi,ki.

    Yes,I was trying to generate a .dat file manually through matlab using fprintf function.Look at the scripts below:

    fid=fopen(FileName2,'w');

    fprintf(fid,'1651 2 %d 1 %x\n',5000,len);

    fprintf(fid,'%d\n',RawData);

    fclose(fid);

    which "RawData" is the original data and "len" is the length of the original data.

    Since fprintf function only support 10-based signed numbers.If it goes to 16-based number,it could only be unsigned.However,in CCS,data types supported in Graph tool are 16 or 32 based numbers.So I can't sure whether it's appropriate to write decimal numbers while they're read in hexadecimal ways.

    I tried generate a .dat file containing a sine wave @1500Hz matlab using functions above,but when I looked in CCS graph tool(FFT magnitude),with parameters set correctly,it shows it's @1000Hz.So I don't know if it's right to write in decimal ways.

    Thanks.