I've asked Atmel technitian about my problem and received the answer:
"Hi,
It is because your code from elm-chan is not functional, please refer to our sample code from
http://www.atmel.com/dyn/resources/prod ... 9rl-ek.zip.
Best Regards,
Allen Ke
Atmel Technical Support Team."
My purpose is to get data from image and convert it into matrix to process, aim to a higher image resolution using interpolation method. I also use "stdio.h" library in C, two function "fopen" and "fscanf". But it not work in AT91Sam9RL kit.
Example: I use geting-start-project to stimulate, change wait time by this code:
int tre(void) // this fuction work well in Turbo C
{
int i, j;
int arr [MAX][MAX];
FILE *fin, *fout;
fin=fopen("C:\\Documents and Settings\\NHC\\Desktop\\Workplace\\test.txt","r");
// there only an 4x4 matrix in file test.txt which arr[1][1]=2 just for testing
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
fscanf(fin,"%d \n",&arr[i][j]);
}
}
fclose(fin);
return arr[1][1]; // I use arr[1][1]=2 for a in main()
}
//------------------------------------------------------------------------------
// Exported functions
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// Application entry point. Configures the DBGU, PIT, TC0, LEDs and buttons
/// and makes LED\#1 blink in its infinite loop, using the Wait function.
/// \return Unused (ANSI-C compatibility).
//------------------------------------------------------------------------------
int main(void)
{
int a;
// DBGU configuration
TRACE_CONFIGURE(DBGU_STANDARD, 115200, BOARD_MCK);
printf("-- Getting Started Project %s --\n\r", SOFTPACK_VERSION);
printf("-- %s\n\r", BOARD_NAME);
printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__);
// Configuration
ConfigurePit();
ConfigureTc();
ConfigureButtons();
ConfigureLeds();
a= tre();
a=a*1000;
// Main loop
while (1) {
// Wait for LED to be active
while (!pLedStates[0]);
// Toggle LED state if active
if (pLedStates[0]) {
LED_Toggle(0);
printf("1 ");
}
// Wait for 500ms
Wait(a);
}
}
///////////////////////////////////////////////
It is have no errors, but not work on AT91SAM9RL kit,,,,?? I'm so confuse...