CE433 Lecture 2022 Spring
Lecture 9
Name:
Braden Morrow
Email: bdmorrow@fortlewis.edu

1. Lecture 9 - Universal Serial Bus (USB)

2. Introduction
The purpose of this lecture was to use the 
PIC24FJ128 microcontroller to interface with a standard USB keyboard and both solely read the output, and then also convert that output to ASCII and send it to the serial monitor via the UART protocol.

3. Results
Task 1:
This task asked us to read the input from the keyboard and toggle the lower byte led's which corresponded to the number on the keyboard being pressed, and also output the scan code to the upper byte of led's. Figure 1 shows the code implemented and Figure 2 shows the results.

Figure 1. Code for Displaying Keyboard Input on On-Board LED's

Figure 2. Results from Displaying Keyboard Input on On-Board LED's

Task 2:
This task asked us to read the input from the keyboard and toggle the lower byte led's which corresponded to the number on the keyboard being pressed, and also output the scan code to the upper byte of led's. It then also asked us to implement a UART transmitter to pass the ASCII code for the key pressed to the serial monitor. Figure 3 shows the code implemented and Figure 4 shows the results.

Figure 3. Code for Displaying Keyboard Input on On-Board LED's and ASCII Characters to the Serial Monitor

Figure 4. Results from Displaying Keyboard Input on On-Board LED's and ASCII Characters to the Serial Monitor

4. Discussion
This assignment helped me understand standard USB protocols and how to decode scan codes from a modern standard keyboard. The major lesson learned was in interfacing the UART transmitter and the keyboard output. That actually took a long amount of time and I was very surprised to see how well it worked. I was happy to get the ooportunity to work with the UART protocol, especially with a relatively complex system like we made for this project.