Forum Discussion
Altera_Forum
Honored Contributor
12 years agoHi,
What do you mean the terminal value hasn't changed? Is this in reference to what your print statement is outputting? Can you explain what this code is supposed to do? for(i=0;i<20;i++)
{
sample_ddr = IORD(SDRAM_BASE,0x00300000+i);
sample = sample_ddr&0x0000FFFF;
sample = sample_ddr>>16;
printf("%4d\n%4d\n",sample,sample);
} Also, how have you declared "sample_ddr" and "sample[]"? Since your right shifting bits, hopefully sample is an array of unsigned ints :) IORD returns an unsigned int, 32-bits. So, you're incrementing your memory reference by 4 bytes on every interval of your loop. If you're debugging what's being read back from IORD, I'd suggest using a debugger to view the memory. If you want to stick with printing the values, I'd at least print the entire 32-bit read and would personally output it in hex, if you know how the data is supposed to be formatted in the register.