Hi all,
this is very simple program but I am not getting why it is behaving like this. The second loop is not working as I expected whats wrong in that.
This program's expected o/p isCode:int main() { int i,j=5; Xuint8 data[i]; Xuint32 * const customLogicPtr = (Xuint32 *)0x84018000;//bram base print("Enter the desired number\r\n"); for(i=0;i<5;i++) { data[i] = XUartLite_RecvByte(0x84000000); *(customLogicPtr+i) = data[i]; xil_printf("%c,%x\r\r\n",*(customLogicPtr+i),customLogicPtr+i); } print (" This is the temporary register...\r\n"); while (j) { j--; xil_printf("%c,%x\r\r\n",*(customLogicPtr+j),customLogicPtr+j); } return 0; }
Enter the desired number
1,84018000
2,84018004
3,84018008
4,8401800C
5,84018010
This is the temporary register...
5,84018010
4,8401800C
3,84018008
2,84018004
1,84018000
But I am getting
Enter the desired number
1,84018000
2,84018004
3,84018008
4,8401800C
5,84018010
This is the temporary register...
1,84018010 /* why it printing value 1 at this address
4,8401800C
5,84018008 /* here aswell*/
2,84018004
1,84018000
Thanks in advance



LinkBack URL
About LinkBacks


