SphinX
Advanced Member level 3
spartan3 kit
Salam,
Ok now, you have Spartan3 Kit and you want to build some projects.
I have choosed LED Blink proj. for you
This project blinks LED attached to FPGA every 1 seconds using on-board 50Mhz clock..
Lets start
Here is VHDL Code for divide 50Mhz to 1Hz
To blink a led every 1 sec, you have to creat a new process, and inside this process test Hertz_en value, if it's 1 then flip a signal called ClkBit,
Finally assign the IO port to this signal.
Here is the code
FPGA IO connections
Clk50 = T9
Rst = M13
ClkOut = K12
Sphinx
Bye
Salam,
Ok now, you have Spartan3 Kit and you want to build some projects.
I have choosed LED Blink proj. for you
This project blinks LED attached to FPGA every 1 seconds using on-board 50Mhz clock..
Lets start
Here is VHDL Code for divide 50Mhz to 1Hz
Code:
process (Clk50,rst)
begin
if Rst='1' then
mhertz_en<='0';
mhertz_count<=(others=>'0');
elsif Clk50'event and Clk50='1' then
mhertz_count<=mhertz_count + 1;
if mhertz_count="110010" then
mhertz_en<='1';
mhertz_count<=(others=>'0');
else
mhertz_en<='0';
end if;
end if;
end process;
-- Generate 1HZ signal from 1Mhz signal
process (Clk50,rst)
begin
if Rst='1' then
hertz_en<='0';
hertz_count<=(others=>'0');
elsif Clk50'event and Clk50='1' then
if mhertz_en='1' then
hertz_count<=hertz_count + 1;
if hertz_count="11110100001001000000" then
hertz_en<='1';
hertz_count<=(others=>'0');
else
hertz_en<='0';
end if;
else
hertz_en<='0';
end if;
end if;
end process;
To blink a led every 1 sec, you have to creat a new process, and inside this process test Hertz_en value, if it's 1 then flip a signal called ClkBit,
Finally assign the IO port to this signal.
Here is the code
Code:
-- Blink LED every 1 Second :-)
process (Clk50,Rst)
begin
if Rst='1' then
ClkOut<='0';
elsif Clk50'event and Clk50='1' then
if hertz_en='1' then
ClkBit<= not ClkBit;
end if;
end if;
ClkOut<=ClkBit;
end process;
FPGA IO connections
Clk50 = T9
Rst = M13
ClkOut = K12
Sphinx
Bye