Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

Car Park Indicator System

i need to design a car park indicator system for a space with 8 lots. it needs to have the following specifications:

  1. a seven-segment display to indicate the number of free lots.

  2. presettable up/down counter

  3. each lor has a light which will turn on to indicate that is free

  4. the light should turn off when the lost is occupied

  5. when the lot is filled to the maximun of 8 cars, the seven-segment should display 'F' the indicate it is full

i have to write a VHDL code for this but i aint sure how to, can any one help me with it? i aint sure if what i did is right or wrong

LIBRARY ieee;

USE ieee.std_logic_1164.ALL;

ENTITY carpark IS

PORT(

d0,d1,d2,d3,clock, reset, led : in std_logic;

in_sensor : in std_logic;

out_sensor : in std_logic;

l : out std_logic_vector (7 downto 0);

a,b,c,d,e,f,g : out std_logic);

q: out std_logic_vector(2 downto 0 ));

end carpark;

architecture arc of carpark is

signal input: bit_vector (3 downto 0);

signal output_lights: bit_vector (7 downto 0);

signal output_7segment: bit_vector (6 downto 0);

type state type is (l0,l1,l2,l3,l4,l5,l6);

begin

process (in_sensor, out_sensor)

begin

output_lights <= "1";

elsif falling_edge (out_sensor) then

output_lights <= output_lights -1;

end if;

input (3)<= d3;

input (2)<=d2;

input (1)<=d1;

input (0)<=d0;

begin

input<= d3 & d2 & d1 & d0;

with input select

output<= "0000000" when "0000",

"0001111" when "0001",

"0100000" when "0010",

"0100100" when "0011",

"1001100" when "0100",

"0000110" when "0101",

"0010010" when "0110",

"1001111" when "0111",

"0111000" when "1000",

"1111111" when others;

a <= output(6);

b <= output(5);

c <= output(4);

d <= output(3);

e <= output(2);

f <= output(1);

g <= output(0);

end if;

end process;

end carpark;

13 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Finally I give you a tip: Use tabs to line your code. As you start a block (if, begin, port, etc.) you use a tab on the next line, this improves reading and thereby you can easily find problems related to errors like 10500.

    --- Quote End ---

    that was because the forum strips out leading whitespace unless you use code tags.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    that was because the forum strips out leading whitespace unless you use code tags.

    --- Quote End ---

    I know, but still, if you do this right it helps. You'll be surprised how many times I get code from project mates who don't use this.