Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21615 Diskussionen

Car Park Indicator System

Altera_Forum
Geehrter Beitragender II
2.584Aufrufe

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;
0 Kudos
13 Antworten
Altera_Forum
Geehrter Beitragender II
1.817Aufrufe

lots of syntax errors. I suggest fixing these before we go further.

Altera_Forum
Geehrter Beitragender II
1.817Aufrufe

could you help me with it? i am so confused and i dont know how to do it

Altera_Forum
Geehrter Beitragender II
1.817Aufrufe

Run it through a compiler and it will tell you

Altera_Forum
Geehrter Beitragender II
1.817Aufrufe

It looks like a school assignment, am I right. If it is, you could also ask your teacher.

Altera_Forum
Geehrter Beitragender II
1.817Aufrufe

well there is alot of problems and i dunno how to solve them

Altera_Forum
Geehrter Beitragender II
1.817Aufrufe

 

--- Quote Start ---  

It looks like a school assignment, am I right. If it is, you could also ask your teacher. 

--- Quote End ---  

 

 

it is but my teacher wont help with this assignment
Altera_Forum
Geehrter Beitragender II
1.817Aufrufe

 

--- Quote Start ---  

well there is alot of problems and i dunno how to solve them 

--- Quote End ---  

 

 

Run the code through a compiler - it will tell you where the errors are and what they are. Then you can fix them.
Altera_Forum
Geehrter Beitragender II
1.817Aufrufe

True, it is difficult to tell or spot some minor error. Any compiler give u more precise information on what the problem is. Also it will show u which line is problematic. With this info, if u still not able to fix, u can paste the error here, and people and help u from there

Altera_Forum
Geehrter Beitragender II
1.817Aufrufe

 

--- Quote Start ---  

True, it is difficult to tell or spot some minor error. Any compiler give u more precise information on what the problem is. Also it will show u which line is problematic. With this info, if u still not able to fix, u can paste the error here, and people and help u from there 

--- Quote End ---  

 

 

 

these are the errors 

Error (10500): VHDL syntax error at carpark.vhd(10) near text "q"; expecting "end", or "begin", or a declaration statement 

Error (10500): VHDL syntax error at carpark.vhd(10) near text ")"; mismatched closing parenthesis  

Error (10523): Ignored construct carpark at carpark.vhd(3) due to previous errors 

Error (10500): VHDL syntax error at carpark.vhd(18) near text "type"; expecting ";", or "is" 

Error (10500): VHDL syntax error at carpark.vhd(24) near text "elsif"; expecting "end", or "(", or an identifier ("elsif" is a reserved keyword), or a sequential statement 

Error (10500): VHDL syntax error at carpark.vhd(24) near text "then"; expecting "(", or "'", or "." 

Error (10500): VHDL syntax error at carpark.vhd(26) near text "if"; expecting "process" 

Error (10500): VHDL syntax error at carpark.vhd(34) near text "begin"; expecting "end", or "(", or an identifier ("begin" is a reserved keyword), or a sequential statement 

Error (10500): VHDL syntax error at carpark.vhd(36) near text "with"; expecting "end", or "(", or an identifier ("with" is a reserved keyword), or a sequential statement 

Error (10500): VHDL syntax error at carpark.vhd(37) near text "when"; expecting ";" 

Error (10500): VHDL syntax error at carpark.vhd(55) near text "if"; expecting "process" 

Error (10396): VHDL syntax error at carpark.vhd(57): name used in construct must match previously specified name "arc" 

Info: Found 0 design units, including 0 entities, in source file carpark.vhd 

Error: Quartus II Analysis & Synthesis was unsuccessful. 12 errors, 0 warnings 

Error: Peak virtual memory: 222 megabytes 

Error: Processing ended: Wed Jul 31 22:10:50 2013 

Error: Elapsed time: 00:00:04 

Error: Total CPU time (on all processors): 00:00:03 

Error: Quartus II Full Compilation was unsuccessful. 14 errors, 0 warnings
Altera_Forum
Geehrter Beitragender II
1.817Aufrufe

You should check the second error first. in this case I think it is also the cause of at least the first error. 

ad in the process you start with an elseif, you should start with an if statement. I suggest reading chapters (or search the web) about the if statement. 

Also you should take a look at how to open and close entities and architectures. 

 

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.
Altera_Forum
Geehrter Beitragender II
1.817Aufrufe

Why are you telling us and not fixing them?

Altera_Forum
Geehrter Beitragender II
1.817Aufrufe

 

--- 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
Geehrter Beitragender II
1.817Aufrufe

 

--- 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.
Antworten