Piezo buzzer is an electric component that comes in different shapes and sizes, which can be used to create sound waves when provided with electrical signal.
Interfacing Piezo buzzer with CoolRunner-II CPLD
The CoolRunner-ii board has Piezo buzzer, indicated as in Figure. Buzzer is driven by transistor Q. CPLD can create sound by generating a PWM(Pulse Width Modulated) signal – a square wave signal, which is nothing more than a sequence of logic zeros and ones. Frequency of the square signal determines the pitch of the generated sound. To enable buzzer place jumper JP at E label mark position.
Pin Assignment with CoolRunner-II CPLD
Circuit Diagram to Interface Buzzer with CoolRunner-II
VHDL Program for Buzzer using CoolRunner-II CPLD
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
entity buzz is
port ( clock : in std_logic;
a : out std_logic
architecture Behavioral of buzz is
variable i : integer := 0;
if clock'event and clock = '1' then
if i <= 50000000 then
i := i + 1;
a <= '1';
elsif i > 50000000 and i < 100000000 then
i := i + 1;
a <= '0';
elsif i = 100000000 then
i := 0;