How can I turn a Keyboard's buttons into switches? (Embedded Sys)

  • Thread starter Thread starter Bizantium
  • Start date Start date
  • Tags Tags
    Switches
Click For Summary

Discussion Overview

The discussion revolves around the challenge of interfacing a standard PS/2 keyboard with an arcade game, aiming to use keyboard keys as switches instead of traditional joystick buttons. Participants explore methods for tapping into PS/2 data and clock signals, considering the implications for embedded systems.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant seeks an efficient method to use a PS/2 keyboard as a switch interface for an arcade game, suggesting the need for a decoder rather than a keyboard encoder.
  • Another participant points out that PC keyboards generate scan codes, referencing a wiki article for further information on this topic.
  • A participant expresses concern about the complexity of programming different keyboards, noting that each keyboard may have unique signals for the same keys, and questions whether an MCU can read these signals without defining them explicitly.
  • Another participant clarifies that all PC keyboards use the same scan codes for specific keys, although variations exist in the number of keys and corresponding scan codes across different models.

Areas of Agreement / Disagreement

Participants generally agree that PC keyboards use the same scan codes for specific keys, but there is uncertainty regarding the programming requirements for different keyboard models and the feasibility of using an MCU to read signals without extensive definitions.

Contextual Notes

The discussion highlights potential limitations in understanding the specific requirements for interfacing with different keyboard models and the need for clarity on how scan codes are interpreted in embedded systems.

Bizantium
Messages
2
Reaction score
0
I'm working on a project in my job, but being only a student in CE and Comp. Sci. I'm limited in knowledge.

I'm looking for a way to communicate with an arcade game, with a standard PS/2 Keyboard. Eliminating the standard joystick and buttons and using a keyboard instead. What would be the best and efficient way into tapping into PS/2 data and clock signals and get them to act as a switch? Where " W " key is UP, S is down, etc etc.

Basically I'm looking for the complete opposite of a Keyboard Encoder, which I imagine would be a Decoder. I've seen some Atmel chips that will do the job but I'm just not sure if there's another more easier way? As of now, what I do is rip the keyboard open and rewire it. This method is time consuming and I know there's something like a Decoder where the ASCII signals can be tapped into with much ease, and I can reprogram them to have them act as switches..

Any insight?
 
Computer science news on Phys.org
PC keyboards generate scan codes, you can start with this wiki article:

http://en.wikipedia.org/wiki/Scancode

I'm not sure what you'd need to provide an interface to power the keyboard and received the scan codes.
 
Yeah the interface is mainly what I'm looking for in this case. I know each key has their own code, and the keyboards vary with their signals and it all gets interpreted by the computer ( our home PC ). But when It comes to embedded systems I can see that things get more complex.

If I am not mistaking each keyboard would have to be programmed differently in this sense if I were to make each key act as a switch. An IBM keyboard would give it's signals from key A, and a Logitech Keyboard ( both PS/2 ) would give off it's own unique signal for letter A?

Or if there's anybody here that can confirm to me logically or by experience that an MCU can can read these signals without having to actually #define them and layout the entire matrix? If so, can a simple If() statement be used to ground a specific unique port for different characters?
 
Bizantium said:
An IBM keyboard would give it's signals from key A, and a Logitech Keyboard ( both PS/2 ) would give off it's own unique signal for letter A?
All PC keyboards use the same scancodes, although some have have more keys and more scan codes than other keyboards. The scancodes for w a s d would be the same for any PC keyboard. Link from the wiki article about interfacing with a PC keyboard:

http://www.beyondlogic.org/keyboard/keybrd.htm
 
Last edited:

Similar threads

Replies
37
Views
7K
Replies
11
Views
4K
  • · Replies 10 ·
Replies
10
Views
3K
Replies
18
Views
6K
  • · Replies 7 ·
Replies
7
Views
12K
  • · Replies 4 ·
Replies
4
Views
4K