The
user presses a key on the keyboard, this sends a keyboard PS/2 scan
code to the Basys3 over the USB-HID port. This scan code is read and
transmitted to a terminal application via the USB-UART bridge. When the
key is released, a scan code of F0XX is transmitted, indicating that
the key with PS/2 code XX has been released.
The Basys 3 board
has a PIC24FJ128 microcontroller that provides USB HID host capability.
We will use this option to develop the HDL projects here. Specifically,
we will focus on interfacing a keyboard to Basys3 board since the
PIC24FJ128 chip available on the board converts the USB input to
standard PS/2 signals to communicate with a mouse or keyboard. Here,
the Basys3 board will be the receiver. The keyboard will be the
transmitter. Therefore, we will focus only on the USB-receiving module
next.
The transmitted code is
called a scan code and is further sub-classed as a 'make' code in the
case of a key being pressed. If a key is held down without being
released, the make code for that key will be sent continuously, in
accordance with the defined auto-repeat (typematic) rate. It should be
noted that if more than one key is pressed and held down, typematic
mode only applies to the last key pressed. When a pressed key is
released, an additional scan code is sent to the host to let it know
that the key that was pressed has now been released. This additional
transmitted code is called a 'break' code.
In the "STOP" state, the
partiy checker is an odd parity checker. Line 39 means it reports error
if bit "prty" is not equal to ~^received.
The demonstration:
2. Send the Scan Code to a seriial terminal
We can combine the UART tx module here to display the key values on the serial monitor.
Draw the system diagram helps the desgin of the RTL:
Here is the video demonstration.
--------------- Tasks: 1. Repeat the work in Section 1. (10 points) 2. Design the testbench and the scan code to ASCII converter to display key values on the serial monitor. (90 points)