You are currently viewing Slide switch and Push Button interfacing with CPLD Development Kit

Slide switch and Push Button interfacing with CPLD Development Kit

Spread the love

Slide switch

Slide switches are most common used in electronic circuits for digital input of ON/OFF states. They allow control over current flow in a circuit. You’ll usually find slide switches in SPDT or DPDT configurations.

Push Buttons

Push-button switches are the classic momentary switch. Typically these switches have a really nice, tactile feedback when you press them. 

Schematic to interface Slide Switch and Push Button with CPLD Development Kit

Slide Switch and Push Button Placement in CPLD Development Kit

Interfacing Slide Switch and Push Button with CPLD Development Kit

Push Button interface is straight forward. One end of Push Button connected to CPLD and another end connected to ground. Slide switch interface to CPLD is Pulled High by default at open end and another end is connected to ground which act as OFF State.

VHDL Code for Slide Switch Interfacing with CPLD Development Kit

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

use IEEE.STD_LOGIC_ARITH.ALL;

use IEEE.STD_LOGIC_UNSIGNED.ALL;

 

entity sw_led is

    Port ( sw : in  STD_LOGIC_VECTOR (15 downto 0);

           led : out  STD_LOGIC_VECTOR (15 downto 0));

end sw_led;

 

architecture Behavioral of sw_led is

 

begin

led<=sw;

 

end Behavioral;

User Constraint File

NET "led[0]" LOC = P35;

NET "led[1]" LOC = P36;

NET "led[2]" LOC = P37;

NET "led[3]" LOC = P38;

NET "led[4]" LOC = P39;

NET "led[5]" LOC = P40;

NET "led[6]" LOC = P41;

NET "led[7]" LOC = P43;

NET "led[8]" LOC = P54;

NET "led[9]" LOC = P55;

NET "led[10]" LOC = P56;

NET "led[11]" LOC = P57;

NET "led[12]" LOC = P58;

NET "led[13]" LOC = P60;

NET "led[14]" LOC = P61;

NET "led[15]" LOC = P62;

NET "sw[0]" LOC = P44;

NET "sw[1]" LOC = P45;

NET "sw[2]" LOC = P46;

NET "sw[3]" LOC = P47;

NET "sw[4]" LOC = P48;

NET "sw[5]" LOC = P49;

NET "sw[6]" LOC = P50;

NET "sw[7]" LOC = P51;

NET "sw[8]" LOC = P63;

NET "sw[9]" LOC = P64;

NET "sw[10]" LOC = P66;

NET "sw[11]" LOC = P67;

NET "sw[12]" LOC = P69;

NET "sw[13]" LOC = P70;

NET "sw[14]" LOC = P71;

NET "sw[15]" LOC = P72;

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.