Altera_Forum
Honored Contributor
14 years agoCharacter Register
Hi, (forgive me if I am posting in the wrong section) I am new to the VHDL programming language and I am currently working on a project (laser Pointer Projector) using the Altera DE2 board to implement this. The project is meant to receive a user input of a character/letter form a ps2 keyboard and display/project the Character/letter in dot matrix form via a laser pointer/diode.
I have come stuck with the comparing the keyboard scancode and generating a pulse sequence for the laser diode. The code seems to output the last statement and ignores the conditions in the code. Below is part of my register code in VHDL with comments for explanation. Could anyone advise me on a different way of doing this or point out what I am doing wrong please. LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity reg is Port ( scancode : in STD_LOGIC_VECTOR (7 downto 0); laser : out STD_LOGIC_VECTOR (7 downto 0)); end reg; architecture Behavioral of reg is Signal char : STD_LOGIC_VECTOR (7 downto 0); begin process(scancode) begin case scancode is WHEN "01000101" => -- scancode for the number 0 laser <= "11000001"; WHEN "00010110" => -- scancode for the number 1 laser <= "11110001"; WHEN "00011110" => -- scancode for the number 2 laser <= "10101100"; WHEN "00100110" => -- scancode for the number 3 laser <= "01100011"; WHEN OTHERS => -- when no scancode present laser <= "11111111"; end case; end process; end Behavioral; This code is a modification of displaying the number on a seven seg display. However, using this logic (code above), and shifting the laser vector through a shift register it ignors all conditions and pulses the laser diode in accordance to the last statement ( laser <= "11111111") Any help on this would be appreciated. Thanks in advance.