2021-07-20 10:48:14 -04:00
|
|
|
Button Controller
|
2021-07-29 22:50:41 -04:00
|
|
|
~~~~~~~~~~~~~~~~~
|
2021-07-14 21:41:09 -04:00
|
|
|
|
2021-07-20 10:48:14 -04:00
|
|
|
This example demonstrates using a button debouncer state machine to count the number of presses on the
|
|
|
|
center button of the basys3 board. The number of presses counted by the debouncer state machine will
|
|
|
|
be given on the two right most digits of the display. The two left most digits record the number of
|
|
|
|
presses counted without the debouncer. You can reset the button counter by pressing the up button on
|
|
|
|
the board. To build the design first navigate to the additional examples directory:
|
2021-07-14 21:41:09 -04:00
|
|
|
|
|
|
|
.. code-block:: bash
|
2021-07-16 22:32:06 -04:00
|
|
|
:name: additional-examples
|
2021-07-14 21:41:09 -04:00
|
|
|
|
|
|
|
cd additional_examples
|
|
|
|
|
|
|
|
Then run make to compile the design:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
:name: example-debouncer-basys3
|
|
|
|
|
2021-07-20 10:48:14 -04:00
|
|
|
make -C button_controller
|
2021-07-14 21:41:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
At completion, the bitstream is located in the build directory:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2021-07-20 12:24:07 -04:00
|
|
|
cd button_controller/build/basys3
|
2021-07-14 21:41:09 -04:00
|
|
|
|
|
|
|
Now, you can upload the design with:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
openocd -f ${INSTALL_DIR}/${FPGA_FAM}/conda/envs/${FPGA_FAM}/share/openocd/scripts/board/digilent_arty.cfg -c "init; pld load 0 top.bit; exit"
|
|
|
|
|
|
|
|
The following is an example of the debouncer in action:
|
|
|
|
|
|
|
|
.. image:: ../images/debounce.gif
|
|
|
|
:align: center
|
|
|
|
:width: 50%
|
|
|
|
|
|
|
|
|