So how does a PS/2 keyboard interface work?

So how does a PS/2 keyboard interface work?

Ben Eater

3 года назад

483,106 Просмотров

Check out https://eater.net for more computer engineering stuff!
List of scancodes from the video: https://docs.google.com/document/d/1w--ouGvSSf93tFltmBcSRGMN8Rte7ayalQZRDPG0ezk/edit

Support these videos on Patreon: https://www.patreon.com/beneater or https://eater.net/support for other ways to support.

------------------

Social media:
Website: https://www.eater.net
Twitter: https://twitter.com/ben_eater
Patreon: https://patreon.com/beneater
Reddit: https://www.reddit.com/r/beneater

Special thanks to these supporters for making this video possible:
Aleksey Smolenchuk, Alexander Wendland, Andrew C. Young, Anson VanDoren, Anthanasius, Armin Brauns, Ben Cochran, Ben Dyson, Ben Kamens, Ben Williams, Bill Cooksey, Binh Tran, Bouke Groenescheij, Bradley Pirtle, Bradley Stach, Brent Reusing, Brian T Hoover, Bryan Brickman, Bryan Glezerson, CaffeinatedClockmaker, Carlos Ambrozak, Christopher Blackmon, Dale Andrew Darling, Daniel Jeppsson, Daniel Tang, Dave Burley, Dave Walter, David Brown, David Clark, David Cox, David House, David Sastre Medina, David Turner, David Worsham, Dean Winger, Dissy, dko, Dmitry Guyvoronsky, dstensnes, Dušan Dželebdžić, Dzevad Trumic, Emilio Mendoza, Eric Busalacchi, Eric Dynowski, Erik Broeders, Eugene Bulkin, George Foot, George Miroshnykov, Harry McDow, Ingo Eble, Ivan Sorokin, james schaefer, Jared Dziedzic, Jason DeStefano, Jason Specland, JavaXP, Jay Binks, Jayne Gabriele, Jeffery Springs, Jeremy A., Jim Kelly, Jim Knowler, Jim Van Meggelen, Joe Beda, Joe OConnor, Joe Pregracke, Joel Jakobsson, Joel Miller, John Fenwick, John Meade, Jon Dugan, Joseph Portaro, Joshua King, Kai Wells, Kefen, Kenneth Christensen, Kent Collins, Koreo, Lambda GPU Workstations, Larry, László Bácsi, Lukasz Pacholik, Marcus Classon, Martin Roth, Mats Fredriksson, Matt Krueger, Matthäus Pawelczyk, melvin2001, Michael Garland, Michael Tedder, Michael Timbrook, Michael Weitman, Miguel Ríos, mikebad, Mikel Lindsaar, Miles Macchiaroli, moi n, Nicholas Counts, Nicholas Moresco, Nick, Örn Arnarson, Paul Pluzhnikov, Paul Randal, Pete Dietl, Phil Dennis, Philip Hofstetter, Phillip Glau, PixelSergey, ProgrammerDor, Randal Masutani, Randy True, Raoul van Prooijen, Renaldas Zioma, Ric King, Rob Bruno, Robert Comyn, Robert Diaz, Roland Bobek, sam raza, Sergey Kruk, SonOfSofaman, Stefan Nesinger, Stefanus Du Toit, Stephen, Stephen Riley, Stephen Smithstone, Steve Jones, Tayler Porter, TheWebMachine, Tom, Tyler Latham, Vincent Bernat, Vladimir Solomatin, Walter Montalvo, Warren Miller, xisente, Yee Lam Wan, דויד אללוף
Ссылки и html тэги не поддерживаются


Комментарии:

@mayaencuk3828
@mayaencuk3828 - 31.01.2024 13:11

Man, I came here for the vid's contents but stuck reading the comments for hours! There r as much information here in the comments as (probably, hvnt watch it yet) the vid...

Ответить
@wherami
@wherami - 30.01.2024 22:15

Excellent work

Ответить
@jakubolszewski8284
@jakubolszewski8284 - 08.01.2024 21:34

It's genial that break only give info about press, cause it's function is just to stop programme, so no need for info about letting it.

Ответить
@AlkoSeltzer
@AlkoSeltzer - 27.12.2023 23:28

Спасибо! Было интересно! Как раз поставил себе клавиатуру Mitsumi Millenium)

Ответить
@sjair6526
@sjair6526 - 27.12.2023 04:51

I dug up an old ps2 keyboard I had and built the shift register to check it out. Of course it didn’t work. After playing around with the register and realizing that it worked when I manually entered bits, I wound up tying the clock input from the keyboard high through a 1k resistor and now it works just like in the video. I can’t say that I really know why that worked but maybe I would see it if I had a scope. Why do I find this 70’s technology so fascinating? I just tried to download prime video on my daughters tv. It took like 5 minutes and I wanted to throw it out the window.

Ответить
@gabrielv.4358
@gabrielv.4358 - 16.12.2023 12:14

Muito interessante

Ответить
@DemoniacDeath
@DemoniacDeath - 04.12.2023 10:12

While trying to quickly convert bin to hex in my head I had a random thought: wouldn't it be better if hexedecimal system was based on digits 01234567abcdefgh instead of 0123456789abcdef?

Ответить
@unchaynd7266
@unchaynd7266 - 02.12.2023 02:12

retrieving my old playstation controller from the drawer There's been a misunderstanding.

Ответить
@Glozzom
@Glozzom - 15.11.2023 21:58

It looks like greycode

Ответить
@MrAwesomeSquared
@MrAwesomeSquared - 12.11.2023 14:25

Idk why it was so funny when he revealed 5 more breadboards

Ответить
@Lantertronics
@Lantertronics - 13.10.2023 08:38

I could imagine Costco deciding to stock breadboards when they see Ben Eater coming in.

Ответить
@BAgodmode
@BAgodmode - 11.10.2023 10:13

You keep linking to this eater website, I’m stating to think you have some sort of stake in that website

Ответить
@BrisbaneStomp
@BrisbaneStomp - 20.09.2023 05:28

You should connect a MIDI keyboard to the computer and depending on the modi output you activate a tone file to be played!! 🎉🎉🎉

Ответить
@datatroll4310
@datatroll4310 - 19.09.2023 17:32

Ben, this is a great video and definitely clears up how a USB keyboard works. Thank you!

However, as an OLD gamer who lived through the PS2 to USB transition, the speed a which data could be transferred from the keyboard/mouse to the computer was not the problem. The problem, as I understood it, was that USB (at least back then) needed to be processed by the CPU which might have a high load on it. This created really bad latency that was noticeable. For example, I remember working in AutoCAD and there would be times when the CPU would be working so hard to redraw a view or something, my USB mouse/keyboard couldn't move or accept key presses. But if I plugged in a PS2 mouse/keyboard, I could at least move the mouse again and press ctrl+alt+del to view the Task Manager and make sure the computer hadn't locked up. I'm not a computer guy, but I also thought IRQs were involved somehow as well. Maybe the USB controllers and beefy CPUs of today mitigate that problem, but it was definitely a problem back in the day. And maybe someone w/more computer understanding (@Ben?) can answer that more accurately about how CPU usage and IRQs might impact PS2 vs USB. Anyway, just thought I'd add more context as to why old gamers used PS2 over USB - and God forbid wireless USB and WiFi! 🙂 Thanks again!

Ответить
@kgtuuhffmkk8907
@kgtuuhffmkk8907 - 16.09.2023 00:49

Can't we just log those keypresses in an EEPROM for a good use later, when the owner of the keyboard is not in sight?

Ответить
@cleruso
@cleruso - 17.08.2023 16:21

I'm really blown away by the effort Ben is taking for such videos. It's one thing and already quite an effort to build a single stage of the shift register on a breadboard, with all the tiny cut-to-length-and-bent wiring. But it's totally off my head to build 7 more, while it would have been so much easier to show all of that in a Logic Analyzer or with an Arduino. Can't think of any other channel going through this.

Ответить
@gamalf123
@gamalf123 - 10.08.2023 09:36

does anyone know why there 2 redundant pins on the PS/2 interface? just securing the plug?

Ответить
@zizlog_sound
@zizlog_sound - 31.07.2023 19:27

great video. 🙏
Speaking of what makes sense on the keyboard - why is 0 next to 9 and not in front of 1???
I’m hoping for a manufacturer to make this change.

Ответить
@gfsadds5574
@gfsadds5574 - 28.07.2023 08:29

Btw, is lsb sent first by this keyboard? The output order of led seems to be the reverse of that on the waveform. And MSB is sent first. So lsb in a byte is sent first and MSB is sent first. This is really confusing😂

Ответить
@marcoguilherme2477
@marcoguilherme2477 - 23.07.2023 18:46

Ah! O clássico IBM Model M!

Ответить
@nalinux
@nalinux - 22.06.2023 05:50

Side note, NEVER plug or unplug a PS/2 keyboard or mouse on an old computer while it's powered.
This may destroy the mainboard.

Ответить
@Arick_Lee
@Arick_Lee - 30.04.2023 17:15

This is fantastic. I thank you for sharing your wealth of knowledge on how this works and doing so at such a fine grained level in a very understandable way. I appreciate you.🙏

Ответить
@IncredibleMD
@IncredibleMD - 29.04.2023 02:31

If I don't have a homemade 6502 computer, would store-bought be fine?

Ответить
@2kevbob
@2kevbob - 16.04.2023 21:03

Eevblog meter. Good kit.

Ответить
@saduniwathsala
@saduniwathsala - 13.04.2023 12:11

Please numbering these videos one by one

Ответить
@0bamo0
@0bamo0 - 12.04.2023 08:20

I like how he casually explained how USB keyboards work at the end xD

Ответить
@scottl.1568
@scottl.1568 - 11.04.2023 21:14

Holy hell I grew up with one of those!!

Ответить
@miguelangelbedoyamontenegr7596
@miguelangelbedoyamontenegr7596 - 10.04.2023 18:29

Excelent video. Thank you so much !!!

Ответить
@zackbonneau2567
@zackbonneau2567 - 06.04.2023 00:06

If we want the latch to occur after the shift, and the shift occurs on each falling edge, why not tie the latch pin to posedge of the clock (AKA non inverted)?? The final latch occurs on the final posedge of the clock - when the signal ends.

If anyone understand why he didn’t do this, or what the pros and cons of each method are, I would love to know, as I’m currently in a microcontrollers and assembly course

Ответить
@tramsgar
@tramsgar - 24.03.2023 01:58

Latch the release code to escape!

Ответить
@yash1152
@yash1152 - 21.03.2023 16:07

link for a PS2 to USB cable please! thete are tonnes on amazon, but how to find a working one?

Ответить
@Axellse
@Axellse - 12.03.2023 19:52

I love your content but where do you buy IC's?

Ответить
@milanakik1539
@milanakik1539 - 12.03.2023 05:17

So you kept building until you got (bread)board

Ответить
@Karreth
@Karreth - 19.02.2023 11:52

What sort of monster creates a cable that needs +5V, ground, data and clock and decide to use use black, orange, red and brown wires IN THAT ORDER?

Ответить
@PatrioticGestalt
@PatrioticGestalt - 08.02.2023 18:51

Thanks!

Ответить
@shmehfleh3115
@shmehfleh3115 - 05.02.2023 22:21

You probably know this already, but the original IBM PC did use a microcontroller to read the keyboard. The IBM 8042 keyboard controller chip was basically a microcontroller dedicated to running the old 84-key and 101-key keyboards for PCs, XTs, and ATs. When the PS/2 came out, the 8042 was replaced by the 8742, which added support for the PS/2 mouse. The functionality of these discrete chips were later added to various heavily-integrated super I/O chips in subsequent chipsets.

Ответить
@edwardhandrich6043
@edwardhandrich6043 - 26.12.2022 19:16

That data line looks just like RS232. If you set the baud rate/parity/start/stop correctly, you could just feed the data line into a serial interface chip.

Ответить
@-Bigjordan
@-Bigjordan - 23.12.2022 03:43

OH SHIT I FELL ASLEEP

Ответить
@realdotty5356
@realdotty5356 - 16.12.2022 11:12

Hey Ben! Would you consider doing a video on mixing rgb colors with hardware on one of those 4 legged rgb leds

Ответить
@giantpunchprojects
@giantpunchprojects - 07.12.2022 17:41

This was a fantastic video. Watching your videos along with the experience I have in hardware repair have given me the motivation to get into hardware design. Your videos are some of the most informative and thoroughly thought-out explanations of computing. I appreciate the effort that goes into these videos.

Ответить
@RelativisticVelocity
@RelativisticVelocity - 28.11.2022 00:50

If you look at an old AT motherboard there is an 82C42 keyboard interface chip right next to the connector, I imagine that this chip does all the heavy lifting. Wonder if this is still available and if it can interface easily to the 6502 BBPC

Ответить
@paulspark7287
@paulspark7287 - 19.11.2022 10:33

@Ben Eater Would another way to get the incoming signals propagating be to count every 8 (well.. 11) clock cycles and then set the latch clock high?

I understand how you introduced a delay with adding the 2 hex inverters but isn't that just luck that the time 2 extra gates introduce happens to be enough for 8/11 incoming clock pulses to have occurred? The delay introduced by the 2 hex inverters would have to be big enough to encompass 11 input signal clock pulses wouldn't it?

Ответить
@lefteriseleftheriades7381
@lefteriseleftheriades7381 - 15.11.2022 13:47

Shouldn't the latch be done once after 11 clock pulses?

Ответить
@whoknows8225
@whoknows8225 - 11.11.2022 04:27

this man puts so much effort in his projects, it's bone chillingly good.

Ответить
@j7ndominica051
@j7ndominica051 - 27.10.2022 01:22

The keyboard interface is bigger than the video adapter. How do the shift registers stop at 11 bits each? Why don't they continue shifting continuously breaking packet boundaries? This ps/2 connector is a bit fragile and not self-orienting. I still use my old keyboards because I am used to their layout.

Ответить