I'm writing a c code in Xilinx SDK for microblaze. The variables were defined as:
int xcoi;
int ycoi;
u16 mat[1280][720];
The code reads the image data stored in DDR2 memory and saves it into a variable.
if ((lBtnChanges & bitBtnD) && (lBtnStateNew & bitBtnD))
{
for(xcoi = 0; xcoi<1280; xcoi++)
{
for(ycoi = 0; ycoi<720; ycoi++)
{
mat[xcoi][ycoi] = Xil_In16(pFrame + ycoi*(lLineStride*2) + xcoi*2);
xil_printf("\n\r xcoi = %d ycoi = %d \n\r",xcoi,ycoi);
}
}
}
To check whether code is working properly, I have printed the x and y coordinated in the console. The part of output where I get error is:
xcoi = 11 ycoi = 253
xcoi = 11 ycoi = 254
xcoi = 11 ycoi = 255
xcoi = 11 ycoi = 256
xcoi = 11 ycoi = 257
xcoi = 11 ycoi = 258
xcoi = 11 ycoi = 259
xcoi = 11 ycoi = 260
xcoi = -547553269 ycoi = 261
xcoi = -547553269 ycoi = 262
xcoi = -547553269 ycoi = 263
xcoi = -547553269 ycoi = 264
xcoi = -547553269 ycoi = 265
xcoi = -547553269 ycoi = 266
xcoi = -547553269 ycoi = 267
Why does xcoi change after xcoi = 11 ycoi = 260? Instead it should be xcoi = 11 ycoi = 261 in the next line.