Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

VHDL@@@ how to turn on led depending on output condition!!!!!!!!!!!!!

Status
Not open for further replies.

louis0206

Newbie level 3
Joined
Jan 25, 2011
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,303
How do i display the values 0 to 9 on the 7-segment display and whenever the count is 1, 3 or 5, a Led will turn on. using vhdl

NEED HELP!! i was able to display the values 0to9 on the 7 segment display.
But the important part is when the count is 1, 3 or 5, the led has to light up.

What is need is: the code to light up led
How do i get the led to light up under this condition( IF AND ELSE?)
 

Depends on the language you are using and where you check the 1, 3, 5.
Suppose you are sending 4-bit BCD to a 7-segment decoder. Run the 4 bits to 4 input ports on a microprocessor.
Then read the four bits into a nibble (a 4-bit data type in some languages), say you store it in a variable called number...
In C, the code might look something like:

If (number == 1) || (number == 3) || (number == 5) // || is "OR" in C
LED_Output_Port = 1;
else
LED_Output_Port = 0;
 

I would use the If, then,else statement. If you supplied the code I could help you better.
Theses are the codes to display the value 0-9 in the bcd counters:
Thanks in advance
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity bcd_counter is
port ( clk, reset_bar : in std_logic;
q : out std_logic_vector (3 downto 0));
end bcd_counter;

architecture flow of bcd_counter is

signal count_sig: unsigned (3 downto 0);

begin
process (clk, reset_bar)
begin
if (reset_bar = ‘1’) then
count_sig <= “0000”;

elsif falling_edge (clk) then
if (count_sig = 9) then
count_sig <= “0000”;
else
count_sig <= count_sig + 1;
end if;
end if;
end process;

q <= std_logic_vector (count_sig);

end flow;
 

If you use a case statement like this it should get you close, you may need to mess with a bit.

case count_sig is
when "0001" => sel <= '1';
when "0011" => sel <= '1';
when "0101" => sel <= '1';
when others => sel <= '0';
end case;

Then in your pin assignment sel will be an LED on your board.

With the code you have how did you get the 7 segment display to show the correct number? I have a FPGA (Altera Cyclone 2 board) just interested to know.
 
If you use a case statement like this it should get you close, you may need to mess with a bit.

case count_sig is
when "0001" => sel <= '1';
when "0011" => sel <= '1';
when "0101" => sel <= '1';
when others => sel <= '0';
end case;

Then in your pin assignment sel will be an LED on your board.

With the code you have how did you get the 7 segment display to show the correct number? I have a FPGA (Altera Cyclone 2 board) just interested to know.

THANKS ALOT for the help! The board i'm using is " MAX7000S EPM7128SLC84-7
":-D
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top