cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Newbie
Newbie
2,501 Views
Registered: ‎03-05-2010

how to light LEDs on my own board?

i create a prj using EDK,and add the ".ucf" and ".c" as follow,then update and download bitsteam to my board(XC3S5OOE).i wish the LED wink,but they are laways lighting.i need some help.thanks

 

#include "xparameters.h"
#include "xgpio.h"

int main()
{
 XGpio LED;
 int i=0;
 XGpio_Initialize(&LED, XPAR_LED_DEVICE_ID);
 XGpio_SetDataDirection(&LED,1, 0x00000000);
 while(1)
 {
 XGpio_DiscreteWrite(&LED,1,0x00);
  for(i=0;i<100000000;i++);
 XGpio_DiscreteWrite(&LED,1,0x03);
  for(i=0;i<100000000;i++);
 }
}

 

 

#  Generic Template

Net LED_GPIO_IO_O_pin<0> LOC="P19" |IOSTANDARD=LVCMOS33;
Net LED_GPIO_IO_O_pin<1> LOC="P100" |IOSTANDARD=LVCMOS33;
Net LED_GPIO_IO_O_pin<2> LOC="P102" |IOSTANDARD=LVCMOS33;
Net LED_GPIO_IO_O_pin<3> LOC="P18" |IOSTANDARD=LVCMOS33;

Net fpga_0_clk_1_sys_clk_pin TNM_NET = sys_clk_pin;
TIMESPEC TS_sys_clk_pin = PERIOD sys_clk_pin 50000 kHz;
Net fpga_0_clk_1_sys_clk_pin LOC="P80" |IOSTANDARD=LVCMOS33 ;
Net fpga_0_rst_1_sys_rst_pin TIG;
Net fpga_0_rst_1_sys_rst_pin LOC="P110" |IOSTANDARD=LVCMOS33 ; 

 

0 Kudos
2 Replies
Highlighted
Scholar
Scholar
2,480 Views
Registered: ‎08-14-2007

hi,

 

try to make your "i" variable "volatile"

 

according to my experience 1 seg. is approx 4300000 in a cycle "for"

 

int volatile i;   // or just "volatile  i;"

for(i=0; i<4300000; i++)  // 1 sec delay approx

 

 

good luck

0 Kudos
Highlighted
Scholar
Scholar
2,479 Views
Registered: ‎08-14-2007

Also your UCF constraints are a little strange, because for Spartan 3E 500 board:

 

CLK is in pin C9

LEDs are in pins F12,E12, E11,F11,C11,D11, E9 and F9

 

are you using the FPGA board whose datasheet is ug230.pdf??

 

 

0 Kudos