DSPRelated.com
Forums

problem in reading data in CCS5416 device

Started by megha daga April 20, 2006
Hey Everyone
I am facing a very strange problem. I am working on PEP5416 and I am trying to execute an acoustic model on that. I am using a CCS simulator for that. Well in my code I am opening a file to get data from that. Following are the commands where I am getting problem:
if((fileid = fopen( "8chF.txt", "r" )) == NULL )
printf( "The file 'test' was not opened\n" );

//Read in the number of channels
while(1)
{
if(fgets(temp, 250, fileid) == NULL)
{
exit(1);
}

sscanf(temp, "%s", &temp);
if(!strcmp(temp,"NUMCHAN"))
{
fgets(temp, 250, fileid);
sscanf(temp, "%hu", &numchan);
break;
}

}

//Read in whether or not to do agcdrc
while(1)
{
if(fgets(temp, 250, fileid) == NULL)
{
exit(1);
}

sscanf(temp, "%s", &temp);
if(!strcmp(temp,"DOAGCDRC"))
{
fgets(temp, 250, fileid);
sscanf(temp, "%hu", &doagcdrc);
rewind(fileid);
break;
}
}
Well I am debugging the code right now. I am moving step by step. When I run this on simulator it works fine. but when I run this on the device, it jumps to agcdrc part (second for loop) and doesnt see the numchan part (after the fopen). I dont understand why its doing that. I saw the mixed assembly and source view. the addr is properly allocated to them. 4157 is ending addr of fopen and 4159 is starting of the fgets for numchan.
Someone kindly help me out in this.
Thanks
megha

---------------------------------
Blab-away for as little as 1/min. Make PC-to-Phone Calls using Yahoo! Messenger with Voice.