pia-468x60

pia-728x90

Monday, December 11, 2023

XC9536 CPLD Simple Three-Digit Multiplexing Display Using VHDL

In this VHDL Example, an XC9536 CPLD drives a 3-digit common cathode multiplexing display. It requires a square signal generator for display timing. The generator frequency is 60Hz generated by an on-board NE555 square wave oscillator. Each digits are activated for 16 milliseconds.







XC9536 CPLD Simple Three-Digit Multiplexing Display Using VHDL
XC9536 Prototyping Board 

VHDL codes for this example is very simple. We directly assign 7-segment data to each digits. However we can use VHDL array data type.

  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 14:41:42 12/11/2023
  6. -- Design Name:
  7. -- Module Name: mux_3 - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20. library IEEE;
  21. use IEEE.STD_LOGIC_1164.ALL;
  22.  
  23. -- Uncomment the following library declaration if using
  24. -- arithmetic functions with Signed or Unsigned values
  25. --use IEEE.NUMERIC_STD.ALL;
  26.  
  27. -- Uncomment the following library declaration if instantiating
  28. -- any Xilinx primitives in this code.
  29. --library UNISIM;
  30. --use UNISIM.VComponents.all;
  31.  
  32. entity mux_3 is
  33. Port ( CLK : in STD_LOGIC;
  34. COM : out STD_LOGIC_VECTOR (2 downto 0);
  35. DAT : out STD_LOGIC_VECTOR (7 downto 0));
  36. end mux_3;
  37.  
  38. architecture Behavioral of mux_3 is
  39.  
  40. begin
  41. process(CLK)
  42. variable count : INTEGER RANGE 0 TO 2;
  43. begin
  44. if(CLK'EVENT AND CLK='1') then count:=count+1; end if;
  45. CASE count IS
  46. WHEN 0 =>
  47. DAT<=x"06"; COM<="001";
  48. WHEN 1 =>
  49. DAT<=x"5B"; COM<="010";
  50. WHEN 2 =>
  51. DAT<=x"4F"; COM<="100";
  52. WHEN OTHERS => NULL;
  53. END CASE;
  54. end process;
  55.  
  56.  
  57.  
  58. end Behavioral;
  59.  
  60.  

All 7-Segment data pins share with the on-board output LEDs. So it reduce driving current. I use an ULN2003 transistors array to drive each common pins.

I assign all output pins in Xilinx PACE as follow.

XC9536 CPLD Simple Three-Digit Multiplexing Display Using VHDL
Pin Assignments

Click here to download its source file.

XC9536 CPLD Simple Three-Digit Multiplexing Display Using VHDL

If you are a beginner in VHDL you can watch this video to see the overall process.



No comments:

Post a Comment

Labels