关键代码:
int led_gpiops()
{
int led_cnt;
XGpioPs_Config* ConfigPtr;
ConfigPtr = XGpioPs_LookupConfig(XPAR_XGPIOPS_0_DEVICE_ID);
if (ConfigPtr == (XGpioPs_Config *)NULL) {
return XST_FAILURE;
}
if(XST_SUCCESS == XGpioPs_CfgInitialize(&GpioPs, ConfigPtr, ConfigPtr->BaseAddr));
else return XST_FAILURE;
XGpioPs_SetDirection(&GpioPs, 0, 0x0180);
XGpioPs_SetOutputEnable(&GpioPs, 0, 0x0180);//pin8 pin7
//XGpioPs_SetDirectionPin(&GpioPs, 7, 1);
while(1)
{
for(led_cnt=0;led_cnt<512;led_cnt++)
{
XGpioPs_Write(&GpioPs, 0, led_cnt);
printf("Led_cnt: %xrn", led_cnt);
//delay();
}
}
}
更多回帖