Oppenheimer
Programmer
Hi All,
I'm one of the new members of this discussion platform. And I'm also beginner about the VHDL. I have XLINX CoolRunner-II CPLD bord and I'm trying to learn VHDL. Nowadays, I design a simple counter code to count from 0 to 9 on the seven segment display. But there is an error which I could not understand. You can see my code.In the code UpBtn and DownBtn inputs are stimuluses to increase and decrease the number.
ERROR:HDLParsers:164 - "C:/CPLD_Designs/0-9_UpDown_Counter/NewCounter/Counter/Counter.vhd" Line 73. parse error, unexpected PROCESS, expecting IF
If you comment on the error and write it I'll be grateful to you.
Thanks,
Oppenheimer.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity Counter is
Port ( UpBtn : in STD_LOGIC;
DownBtn : in STD_LOGIC;
Data : out STD_LOGIC_VECTOR (6 downto 0):= "0111111" );
end Counter;
architecture Behavioral of Counter is
shared variable bcd: integer:= 0 ;
begin
process (UpBtn,DownBtn)
variable off: STD_LOGIC_VECTOR (6 downto 0):= "0000000" ;
variable zero: STD_LOGIC_VECTOR (6 downto 0):= "0111111" ;
begin
if rising_edge(UpBtn) then
if bcd= 9 then
bcd:= 0;
else
bcd:=bcd+1;
end if;
else if rising_edge(DownBtn) then
if bcd = 0 then
Data<= off;
Data<= zero after 500 ms;
else
bcd:=bcd-1;
end if;
end if;
case bcd is
when 0 => Data<= "0111111";
when 1 => Data<= "0000110";
when 2 => Data<= "1011011";
when 3 => Data<= "1001111";
when 4 => Data<= "1100110";
when 5 => Data<= "1101101";
when 6 => Data<= "1111101";
when 7 => Data<= "0000111";
when 8 => Data<= "0111111";
when 9 => Data<= "1101111";
when others => Data <= "1000000";
end case;
end process; (LINE:73)
end Behavioral;
I'm one of the new members of this discussion platform. And I'm also beginner about the VHDL. I have XLINX CoolRunner-II CPLD bord and I'm trying to learn VHDL. Nowadays, I design a simple counter code to count from 0 to 9 on the seven segment display. But there is an error which I could not understand. You can see my code.In the code UpBtn and DownBtn inputs are stimuluses to increase and decrease the number.
ERROR:HDLParsers:164 - "C:/CPLD_Designs/0-9_UpDown_Counter/NewCounter/Counter/Counter.vhd" Line 73. parse error, unexpected PROCESS, expecting IF
If you comment on the error and write it I'll be grateful to you.
Thanks,
Oppenheimer.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity Counter is
Port ( UpBtn : in STD_LOGIC;
DownBtn : in STD_LOGIC;
Data : out STD_LOGIC_VECTOR (6 downto 0):= "0111111" );
end Counter;
architecture Behavioral of Counter is
shared variable bcd: integer:= 0 ;
begin
process (UpBtn,DownBtn)
variable off: STD_LOGIC_VECTOR (6 downto 0):= "0000000" ;
variable zero: STD_LOGIC_VECTOR (6 downto 0):= "0111111" ;
begin
if rising_edge(UpBtn) then
if bcd= 9 then
bcd:= 0;
else
bcd:=bcd+1;
end if;
else if rising_edge(DownBtn) then
if bcd = 0 then
Data<= off;
Data<= zero after 500 ms;
else
bcd:=bcd-1;
end if;
end if;
case bcd is
when 0 => Data<= "0111111";
when 1 => Data<= "0000110";
when 2 => Data<= "1011011";
when 3 => Data<= "1001111";
when 4 => Data<= "1100110";
when 5 => Data<= "1101101";
when 6 => Data<= "1111101";
when 7 => Data<= "0000111";
when 8 => Data<= "0111111";
when 9 => Data<= "1101111";
when others => Data <= "1000000";
end case;
end process; (LINE:73)
end Behavioral;