I
I
ip692018-06-06 05:23:20
Microcontrollers
ip69, 2018-06-06 05:23:20

What to choose the fastest microcontroller to create a gaming keyboard (PS / 2)?

Good afternoon
The task is to get the lowest possible response time from the keyboard.
From what I've read in articles and discussions, I need a microcontroller for a PS/2 gaming keyboard.
The available examples that were found are for USB only.
The game is Counter Strike Source.
It is assumed that the required minimum of buttons is W, A, S, D, C (5 pieces).
W - forward
A - left
S - back
D - right
C - crouch
There are also Q and R, but in extreme cases they can be hung on the mouse.
After independent searches, only one more or less informative article was found with a list of fast serial keyboards.
https://habr.com/post/345776
Source -https://danluu.com/keyboard-latency
Found an online test - blog.seethis.link/scan-rate-estimator
Current keyboard - Microsoft MultiMedia Keyboard 1.0a produces modest results:
Shortest Key Press | Estimated Scan Rate
36ms | 27.77777777777778Hz
As the most popular controller, Teensy 2 was found.
Digging deeper, even found an optimization - neophob.com/2011/04/serial-latency-teensy-vs-arduino
There are a few newbie questions.
1. If you take the best from the list - Apple Magic (MLA22LL / A) as a donor, is it possible to improve its result?
2. Does the number of buttons in the matrix affect whether their reduction to the required 5 will win?
3. Does it make sense to consider a Teensy 2 controller for this task?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mirn, 2018-06-06
@Mirn

I was doing a PS/2 keyboard implementation on vanilla intel8051 which is 24MHz 12 clocks per instruction. Back in the 90s, this MK had enough speed to generate key codes by interruptions with direct leg jerks, there are no delays, interruption and polling and the start of transmission take much less time than sending a key code, which is essentially a UART with minor edits (physical level like i2c) - he himself It’s slow for itself and therefore it’s impossible to transmit anything faster than 3000-4000 times per second - it will become a mess of bits if we interrupt the current transmission and start a new one.
Therefore, the answer is simple - any MK that works over 2 million commands per second (in general, any of the modern ones) and has at least one interrupt input is suitable - hang it through the diode AND the output from all the buttons to the ground.

D
Dmitry Romanov, 2018-06-11
@DRomanov1972

The calculation is simple:
- display 120Hz - 8ms
- PS/2 80..300kbps, 3 bytes x 11 bits - 0.1..0.4ms
- anti-bounce delay - min 5ms
------------- ------------------------------------
Total 5ms - for 16MHz AVR this is 80000(40000) instructions - enough for eyes even for the Hindu code with pooling and without interruptions. And on the mind - any 5-volt controller with INT and USART with XCK (or with I2C / TWI or with SPI), for example ATmega8A. If DATA and CLK are directly from the controller's feet, connect them through 200 ohm resistors.
> Available examples which were, only for USB.
By searching for "ps / 2 keyboard on avr" - a sea of ​​\u200b\u200bready-made projects, correct only the key polling speed.
PS: There is no point in chasing a delay of less than 5ms - you won't feel it. In some games, in the settings, there is an input switching System / DirectX (for Windows) or the like. And the operating system + programs can add from 50ms for nothing to do, especially in Windows - then after the next update, then new Chrome or its extensions, then the weather;).

A
Alexey Cheremisin, 2018-06-06
@leahch

In fact, USB, even version 1.0, is much faster than PS/2. 1.5 megabits vs 300 kilobits. So whatever controller you take, you will simply run into the transfer rate.
PS. To the topic - https://habr.com/post/345776/ measurement of keyboard latency.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question