EE 316 Computer Engineering Junior Lab Digital Hangman
Topics Important Specifications for the Digital Hangman game. For details read the project description Serial Port Software PS/2 Keyboards
Digital Hangman Game will be played using a PS/2 keyboard attached to hardware The Personal computer will ● Randomly select word puzzles from a text-file. ● Display all correctly picked letters and positions of unknown letters on the LCD connected via a serial port. ● Keep count of the number of guesses played so far. ● Display messages for the player as specified in the game.
Operational Characteristics of the LCD Display Short messages (20 or fewer characters) –displayed “instantly”, left justified Long messages (>20 characters) –start at right, scroll right to left –scroll at “reading rate” Remain displayed until next message or clear
Software Standard Windows GUI (Windows XP) Must be able to read text-files Must be able to control serial port –use the references in the Project assignment –there are several classes (Cserial and CSerialPort) that are for general use Use them with caution You may want to write your own code too
The PS/2 Keyboard PS/2 device interface was developed by IBM. PS/2 port these days use the 6-pin mini-DIN connectors. The Data and clock are open-collector with pull-up resistors.
PS/2 Keyboard, contd.. PS/2 devices use bidirectional synchronous serial protocol. The device (keypad in this case) generates the clock. The clock frequency is kHz. One byte of data is sent at a time. Each frame from keypad to the PC contains 11 bits. These bits are: 1 start bit. This is always 0. 8 data bits, least significant bit first. 1 Parity bit. 1 stop bit. This is always 1.
Scan code Keyboards consist of a large matrix of keys The keys are monitored or scanned by an on-board processor (aka the "keyboard encoder“). If a key is pressed, held and released, the keypad sends out an 11-bit “Scan code” (data). There are several scan codes. We will use the default code (See Scan code 2) for all modern keyboard.(See Scan code 2)
Keyboard to Host communication The “Make scan code” for Q Stop bit = = 0X15 <= The make scan code for the “Q” key Start bit = 0 Parity bit
References engineering.org/ps2keyboard/scancodes2.htmlhttp:// engineering.org/ps2keyboard/scancodes2.html