i have implemented a powerpc based embedded system in a xilinix vertex-2pro device and trying out an extremely simple program. Here is the code.
#include "xparameters.h" #include "xbasic_types.h" #include "xgpio.h" #include "xstatus.h"
XGpio GpioOutput;
int main() { Xuint32 status; unsigned long i = 0; unsigned long j = 0;
// Initialize the GPIO driver so that it's ready to use, status = XGpio_Initialize(&GpioOutput, XPAR_GENERIC_GPIO_DEVICE_ID); if (status != XST_SUCCESS) return XST_FAILURE; // Set the direction for all signals to be outputs XGpio_SetDataDirection(&GpioOutput, 1, 0x0);
while(1) { XGpio_DiscreteWrite(&GpioOutput, 1, 0xFFFFFFF1); while(i < 10000000) { i++; } XGpio_DiscreteWrite(&GpioOutput, 1, 0xFFFFFFF2); while(j < 10000000) { j++; } i = 0; j = 0;
} return 0; }
As can be seen, this program just blinks two LED's. However what i see is two dimmed LED's. They are dimmed because they blink very fast. It appears like two inner while loops are just skipped. Can anybody guess a reason?
Thanks