What Happens When I Press a Key? - Computerphile

  Рет қаралды 244,890

Computerphile

Computerphile

Күн бұрын

Пікірлер: 349
@stefanamg63
@stefanamg63 6 жыл бұрын
Always nice to see a seemingly simple system explained properly to uncover a hidden complexity I've never given much thought to before. Fascinating video.
@adricortesia
@adricortesia 6 жыл бұрын
"I like my keyboards soft and mushy" quote of the day :D
@aapeli4824
@aapeli4824 6 жыл бұрын
"I like my keyboards soft and mushy" *laughs in mechanical*
@avi8aviate
@avi8aviate 5 жыл бұрын
BHURGVFDI SHOUIE UIEFSL BEVI BUSIOEV VSBUYEOI HUEVSJKD Your laugh in mechanical.
@avi8aviate
@avi8aviate 5 жыл бұрын
@Red Dunkey ygudhhbiuhvjkfkyuhrgnkvhjbikrtuhjgesguhyurhgbjvhgfbvsuyehbnxeruyvhbsiyurghbnvuihsgbxbenuyrghubdfiyugshb
@avi8aviate
@avi8aviate 5 жыл бұрын
@Red Dunkey uygjvj
@Orinslayer
@Orinslayer 4 жыл бұрын
I find the clickety-clacking to be highly therapeutic.
@kirishima4430
@kirishima4430 3 жыл бұрын
This is just superb, I have been researching "which keys are which notes on a piano?" for a while now, and I think this has helped. You ever tried - Penaycer Rudimentary Preponderance - (just google it ) ? It is an awesome one off guide for discovering how to play the piano easily minus the normal expense. Ive heard some unbelievable things about it and my colleague got amazing results with it.
@biehdc
@biehdc 6 жыл бұрын
it goes through tons of layers of abstractions until it reaches some bad electron based application
@adfaklsdjf
@adfaklsdjf 6 жыл бұрын
This is the real story.
@npc6924
@npc6924 6 жыл бұрын
Or when I'm testing my program, a poorly written SDL application
@ThatBrubakerFellow
@ThatBrubakerFellow 4 жыл бұрын
🤮
@lawrencedoliveiro9104
@lawrencedoliveiro9104 6 жыл бұрын
10:02 And one nice thing about scan codes is they don’t distinguish between modifier and non-modifier keys; it’s just “key «n» has been pressed” and “key «n» has been released”, it’s up to the software to decide if key «n» is a modifier key or not. And you can distinguish between e.g. left-shift and right-shift (they have different scan codes), and implement other fun custom behaviours.
@floxbr9350
@floxbr9350 3 жыл бұрын
At least for USB: yes, they do. The state of the modifier keys is encoded in a single byte (which indeed allows a distinction between left-shift and right-shift), then other keys are transmitted individually. Sure, the software can decide what to do with that information, but the modifier keys do play a special role from the hardware perspective.
@PavitraGolchha
@PavitraGolchha Жыл бұрын
​​@@floxbr9350yeah i learnt that in ben eater's video about usb
@andljoy
@andljoy 6 жыл бұрын
It depends on the interface, XT, AT and PS/2 (PS/2 and AT are the same with just a new connector ) are interrupts , USB uses polling. PS/2 AT etc The computer does nothing , the keyboard controller polls the matrix and sends hardware interrupts to the CPU For USB the same thing happens but the keyboard does not send an interrupt, it holds the keys in a buffer till the computer polls it for key presses. Language does not change the scan code set ! AT PS/2 USB ect are ALL scan code set 2 , XT is scan code set 1 ( for some reason) and most terminals and pre PC computers mainframes , serial terminals etc use scancode set 3
@Dracounius
@Dracounius 6 жыл бұрын
USB standards specifies a scan code for USB keyboards, it does not use set 2 (AT). Or if does it is non-compliant with the USB standard for keyboards.
@andljoy
@andljoy 6 жыл бұрын
Yes your correct. But they use the same codes in the background so 2c is Z in USB and in Set 2 so its short hand.
@AlexAegisOfficial
@AlexAegisOfficial 6 жыл бұрын
\[T]/
@0LoneTech
@0LoneTech 6 жыл бұрын
USB is most certainly not using set 2 - for the reason why, look up what the scancode is for the arrow keys, which have a prefix for set 1 compatibility, or the Pause key which is 7 bytes long. USB keycodes are in alphabetic order and Z in particular is 1D (see HID usage tables, section 10 keyboard). Your firmware might be translating it for legacy OS support, however. Set 3 was more logical in that it used a single bit for press/release and one byte for each event. Also, the polling in USB is performed by the host controller, not the CPU, so we still have an interrupt for when things have changed. There are also buffers in both keyboards and port controllers for PS/2, AT etc, but the CPU typically has to handle them byte by byte.
@misterhat5823
@misterhat5823 6 жыл бұрын
I agree. This video is quite oversimplified and erroneous at times.
@noferblatz
@noferblatz 6 жыл бұрын
One thing not mentioned is the "de-bouncing" circuit. As switches, the keyboard switches tend to "bounce" or "ring". One keypress produced not just one, but multiple key-down and key-up events. The "de-bouncer" ensures that these are picked up by the machine as a single press.
@andljoy
@andljoy 6 жыл бұрын
noferblatz you can also fix this with many many diodes (one for each key) , no ghosting then :)
@Thanatos2996
@Thanatos2996 6 жыл бұрын
Andrew Joy you can use diodes to debounce? I've used caps, but never heard of diodes.
@bvbk007
@bvbk007 6 жыл бұрын
Diodes can't be used for debouncing, usually. I think Andrew is mistaken. Ghosting and debouncing are independent of each other.
@raykent3211
@raykent3211 6 жыл бұрын
bvbk007 I agree with you. Might be worth mentioning software debouncing, that I've used on arduino projects. No extra components, the software does a very crude simulation of an RC network response. Maybe called a boxcar filter?
@Thanatos2996
@Thanatos2996 6 жыл бұрын
bvbk007 ok, just making sure I didn't fall asleep in Electronics or something.
@frognik79
@frognik79 6 жыл бұрын
Back in the days of windows 95/98 and XP I used ports 0x60 and 0x64 to communicate with the keyboard controller directly and insert characters into the keyboards output buffer which were then read by windows as normal key presses. This let me get past several games anti cheat / botting software.
@yourmum69_420
@yourmum69_420 3 жыл бұрын
why would you want to cheat?
@jareknowak8712
@jareknowak8712 6 жыл бұрын
I pushed "H" on keyboard, but nothing happened..... :( Does computer have to be turned on?
@jeremyelliot4831
@jeremyelliot4831 6 жыл бұрын
No, computer doesn't need to be on. It sounds like your keyboard is not working. Have you tried restarting your keyboard?
@jareknowak8712
@jareknowak8712 6 жыл бұрын
Jeremy Elliot Yes, i tried, with torch, as always. Did not help. Maybe it needs new oil and spark plugs?
@joedd215
@joedd215 6 жыл бұрын
We'll it does need the voltage to apply to the rows somehow. Try plugging it into a battery
@TruthNerds
@TruthNerds 5 жыл бұрын
This is normal. You have a French keyboard, and the "H" is silent in French. HTH. HAND.
@GaneshMKarhale
@GaneshMKarhale 5 жыл бұрын
No, you need to have common sense.
@lawrencedoliveiro9104
@lawrencedoliveiro9104 6 жыл бұрын
Newton’s Third Law, action = reaction; contemplate the Zen of physics: when you a press a key, the key presses back.
@XHappyKillerX
@XHappyKillerX 6 жыл бұрын
It would be really cool and suit your channel if you made a video about Docker and the differences on how Docker and a full virtual machine realize the virtualization! Love your channel!
@Thanatos2996
@Thanatos2996 6 жыл бұрын
PS/2 interrupts, USB and Bluetooth do not. With the newer ones, the controllers have a buffer which the OS polls. Also, insulting the IBM model M is a bold strategy Cotton.
@mikeklaene4359
@mikeklaene4359 6 жыл бұрын
Years ago I used to program on a desktop system that used Hall Effect keys. The keyboard was specifically designed for data entry. It was made in Utica, NY and was originally called a Cogar System 4. Later Singer bought the company and called it a Singer 1501. When Singer was bought by ICL it became the ICL 1501. A VERY nifty system for its day.
@SteelSkin667
@SteelSkin667 6 жыл бұрын
Dr. Bagley's shirt needs some texture filtering.
@14rs
@14rs 4 жыл бұрын
Some ray tracing
@vylbird8014
@vylbird8014 6 жыл бұрын
The M is the epitome of keyboard perfection. There's a reason it is so remembered: It saw satisfying, comfortable, accurate, and near-indestructible. Very few keyboards achieve that level of quality, and those that do achieve it today are designed specifically in imitation of the M's design and always compared to it.
@andljoy
@andljoy 6 жыл бұрын
No way , model F any day !
@tyrgoossens
@tyrgoossens 6 жыл бұрын
The earlier IBM beamspring is probably the best keyboard mechanism ever made. Unfortunately it comes with some real drawbacks like its huge size and complexity of the capacitive sensing circuitry used.
@andljoy
@andljoy 6 жыл бұрын
Yeh but they are amazing! I love mine. F uses capacitive sensing too but the controller is less fussy about dust etc. Thats why beamsprings come with contamination shields . Or did, they have all rotten away now.
@StevePinkham
@StevePinkham 6 жыл бұрын
Not sure about epitome, but certainly a classic. Have 3 model M keyboards that I used for many years, but now use WASD Code V2 keyboards, with Cherry MX blue switches at home and clears at the office. I like them all better than my M keyboards for layout and feel.
@pengowando8325
@pengowando8325 6 жыл бұрын
I dig how the game Steve thinks up off the top of his head is Quake. Right on mate
@benjaminwilson9007
@benjaminwilson9007 6 жыл бұрын
This explains why when accessing button presses there are the methods GetKeyDown(Key), GetKeyUp(Key), and GetKey(Key). Thank you. And also if anybody knows about Scratch by MIT, their language was not great with those functions. It was very frustrating. Also I prefer quieter keyboards because I typically make videos about what typing and the noise in the video is annoying. But if I'm playing League or something I do like to hear that I have indeed pressed a key.
@Grundibular
@Grundibular 6 жыл бұрын
11:00 onwards was a bit lacking in detail. HOW does the hardware interrupt the CPU? What happens - memory registers? Special pins on the CPU...what EXACTLY?
@hydrochloricacid2146
@hydrochloricacid2146 6 жыл бұрын
Grundibular the implementation varies a bit depending on the cpu itself, but generally speaking, the CPU will have an interrupt controller. When the controller itself receives an interrupt from a device, such as a key press, it will force the processor to save its state and jump to a special part of memory called an interrupt vector table. This table will then tell the cpu where to jump next, into what is called an interrupt service routine, which actually handles the new data. Once this is done, the cpu resumes its previous work.
@RWoody1995
@RWoody1995 6 жыл бұрын
if its a USB keyboard it doesn't interrupt the CPU, PS/2 keyboards do but USB ones rely once again on polling. USB devices communicate by sending 1 frame of data every 1/1000th of a second, this is why many gaming keyboards; in search of a gimmick to make themselves appear advantageous over normal ones... claim an update rate of 1000hz, simply they just send data out on every USB frame, most keyboards update at 125hz because 125 is 1/8th of 1000 so they only need to update on every 8th frame.
@hydrochloricacid2146
@hydrochloricacid2146 6 жыл бұрын
@@RWoody1995 technically speaking, your software does receive USB interrupts. They just aren't generated by the keyboard. To get the load off the CPU, dedicated hardware polls the keyboard at regular intervals, and sends an interrupt to the system when a change occurs
@dudeabideth4428
@dudeabideth4428 4 жыл бұрын
I remember I was asked this in a interview. I got to the interrupt handler in three sentences or less . So is the key value delivered to the current application? What’s the api for it to read ? It’s reading it using an api like a file ?
@ThatBrubakerFellow
@ThatBrubakerFellow 4 жыл бұрын
Most new motherboards that I'm aware of don't have a true PS/2 port. It has a built-in adapter. USB I believe.
@space8862
@space8862 2 жыл бұрын
Has someone already roasted this guy?
@Syncromatic
@Syncromatic 6 жыл бұрын
Video comes up just as I'm doing an assignment that uses interrupts, instruction pointers and a like. On one hand, it's neat timing. On the other, it's the last thing I wanna see xD
@littlemikey46
@littlemikey46 6 жыл бұрын
How can a computer expert not like the model M? It's perfect!
@RaymondHng
@RaymondHng 6 жыл бұрын
I guess he's not a touch typist. I'm typing this on a Model M.
@YellowToad
@YellowToad 4 жыл бұрын
@@RaymondHng me too
@jjbailey01
@jjbailey01 4 жыл бұрын
What I want to know is what happens when I press the key?
@k1ngjulien_
@k1ngjulien_ 6 жыл бұрын
As an r/MechanicalKeyboards member I am offended by his taste in keyboards....
@andljoy
@andljoy 6 жыл бұрын
Hey its dome over PCB is basically a realforce in all but name ! Myself i prefer a good beamspring, or some nice complicated alps. DT > Reddit :P
@charliethomson2789
@charliethomson2789 6 жыл бұрын
He said "I like my keyboard soft and mushy" and I was like no no no no NO NO NO
@k1ngjulien_
@k1ngjulien_ 6 жыл бұрын
quangluu96 I mean their videos are mostly software related so I get why he didn't go into too much detail.
@Chriva
@Chriva 6 жыл бұрын
I presume he does actual work on his machines. Mechanical keyboards are usually frowned upon by coders due to their disturbing nature :) Sit in a cubicle etc with ten other people around you having those things and you'll understand why they're so hated
@LIES666
@LIES666 6 жыл бұрын
You can get quiet mechanical keyswitches that are a decent compromise.
@DotBowder
@DotBowder 6 жыл бұрын
You should make a series out of these, from the keyboard, through the usb/ps2 bus, to the driver, then the os, display driver, monitor, etc. The whole stack from input to output. - or maybe just talk about each piece of the stack for an episode. It's very computerphile centric.
@Yazan_Majdalawi
@Yazan_Majdalawi Жыл бұрын
I was expecting something like this when I first saw the title, I'm really disappointed :(
@webchimp
@webchimp 6 жыл бұрын
"And this is basically the brains of the keyboard..." That's just some PCB track with gaps in, you've already looks at "the brains of the keyboard" on the other side.
@0LoneTech
@0LoneTech 6 жыл бұрын
Yep, those were the feelers.
@paradonym
@paradonym 6 жыл бұрын
but everytime if you mention interrupts - it's nice to explain that modern PCs just have four to eight CPUs in - quickly explaining that multicore is just an array of actual CPUs (cores) in one part of the PC.
@sethother8012
@sethother8012 5 жыл бұрын
At 1:20, he’s trying to begin explaining to us how the circuitry of the keyboard receives a signal, only to be interrupted and asked how many keys are possible to be pressed. Still laughing.
@woopygoman
@woopygoman 6 жыл бұрын
Can you please make a video about the history of focus stealing (foreground window and keyboard cursor) in operating systems and web browsers? It's quite an annoying issue in computing and still hasn't been addressed after decades!
@terrylick5908
@terrylick5908 6 жыл бұрын
i will look for a link that shows you. thankyou
@singularity1130
@singularity1130 6 жыл бұрын
Do touch sensors next!!!
@billaddison82
@billaddison82 6 жыл бұрын
Nice paper man, very nice touch!
@MrGustaphe
@MrGustaphe 6 жыл бұрын
Whoever invented the fn-key needs to get fired. Unlike the other control keys, "fn+A" doesn't actually register as a modification on 'A', meaning that you can't bind things to "fn+A" programmatically. Add to that the fact that there is no standard for fn-lock or no, and that the key itself is always on the opposite side of the keyboard from whatever you want to push it with... Top 3 horrible keyboard "features": 1. fn 2. right-click key 3. insert
@aldobernaltvbernal8745
@aldobernaltvbernal8745 4 жыл бұрын
i wanna make a mouse keyboard now
@Thermophobe
@Thermophobe 6 жыл бұрын
what a baller! got 2 imacs instead of two monitors and a mac
@ragnabob
@ragnabob 6 жыл бұрын
I lol'ed!!! :D
@TruthNerds
@TruthNerds 5 жыл бұрын
Maybe he's particularly decadent and uses one of them in target display mode for the other…
@CarterColeisInfamous
@CarterColeisInfamous 6 жыл бұрын
did you even talk about debouncing the button signal? i might have missed it
@aletoledo1
@aletoledo1 6 жыл бұрын
I liked at the end how his example of a computer game was something from 25 years ago. I bet half the viewers are younger than that game.
@CorrosiveCitrus
@CorrosiveCitrus 6 жыл бұрын
he could have been refering to quake champions - or at least heard about it which is why quake was at the forefront of his mind :)
@robinrai4973
@robinrai4973 6 жыл бұрын
After the model m comment *audible gasp*
@adfaklsdjf
@adfaklsdjf 6 жыл бұрын
I really appreciated the graphic diagrams.. very well done. Thanks.
@LPrulzcrossover
@LPrulzcrossover 2 жыл бұрын
Hmm one question remains for me: Back in the days, why was I able to boost and steer right at the same time in Need for Speed but not able to boost and steer left (shift + arrow keys)? And why was my friend able to do it on his computer with his keyboard?
@Pedritox0953
@Pedritox0953 4 жыл бұрын
Excellent videos Steve!!
@jiffylou98
@jiffylou98 6 жыл бұрын
Great video! I remember opening up my PSP and wondering how the circuit board worked and how it could tell which button was being pushed when they were both connected
@SecularMentat
@SecularMentat 6 жыл бұрын
I rather enjoy this episode. I like the basic breakdowns of computers into their electronic components.
@lewisharp6785
@lewisharp6785 6 жыл бұрын
This helped me decipher the difference between having a pathological or spiritual entity controlling the other end of the conversation when taking to an Artificially intellegent source and having the genuine thing. Thank you. I'm a little paranoid.
@Melvin420x12
@Melvin420x12 6 жыл бұрын
Now I understand why in javascript you can't just ask if "W" is pressed, but instead check if the keyboard tells if a key is pressed and if that key is coincidentally keyCode 87 and then ask if a key is released and if that was coincidentally also keyCode 87.
@x3ICEx
@x3ICEx 6 жыл бұрын
This is part 1, right? Did not even mention interrupts yet.
@Those_Weirdos
@Those_Weirdos 3 жыл бұрын
I like how the subtitles just give up at around 2:20.
@videogamemusicandfunstuff4873
@videogamemusicandfunstuff4873 6 жыл бұрын
3:33 haha, I'm getting stressed just thinking about how much trouble it's going to be to put the keyboard back together after the video
@SeanKD_Photos
@SeanKD_Photos 6 жыл бұрын
Dose this guy not know about the modern mechanical keyboard market? Like come on
@neatoelectro3687
@neatoelectro3687 6 жыл бұрын
of course he does. that's why he said he just started a flame war when He mentioned the Model M.
@MsHojat
@MsHojat 6 жыл бұрын
Model M isn't a modern mechanical keyboard though, so it's not really proof that he's aware of the modern mechanical keyboard movement/fad.
@SecularMentat
@SecularMentat 6 жыл бұрын
Is an IRQ (interrupt request) done by hardware on the cpu?
@lumpyfishgravy
@lumpyfishgravy 6 жыл бұрын
I love it. He was all ready to rock on until ... that wonderfully cryptic question. Spent the rest of the video talking about the hardware / software interface. Yes, I am a firmware engineer.
@AlexAegisOfficial
@AlexAegisOfficial 6 жыл бұрын
8:45 Are you telling that having the keyboard check itself for keypresses and telling the computer to check what was pressed only if the keyboard noticed that keypress beforehand, sent a signal to the computer, the computer checked back what was pressed is faster than constantly polling the keyboard. That makes no sense.
@grancubodemierda
@grancubodemierda 6 жыл бұрын
Győri Sándor it makes perfect sense. The CPU is not constantly polling the keyboard, it is the keyboard that does the dirty polling work and tells the CPU when something happens (which is almost never from a CPU cycles point of view). Imagine you are waiting for an amazon package to come, would you go to the street every 2 minutes to check if the postman is there? Or rather do your usual stuff at home and just pay attention when somebody rings the bell?
@0LoneTech
@0LoneTech 6 жыл бұрын
The message from the keyboard to the computer doesn't tell the computer to check what was pressed, typically. The message sent already holds that information. From the CPU's perspective, keypresses are very rare, and spending time looking for them there would make little sense, particularly as switching tasks is quite costly. The interrupt allows it to jump to the keyboard handling routine only when the keyboard has sent new information.
@AlexAegisOfficial
@AlexAegisOfficial 6 жыл бұрын
No, purely from the perspective of speed, me checking the door every second while I'm standing there is faster than sitting on the couch and only getting up when the bell rings. Because getting to the door takes time too, and the delivery guy has to press the doorbell too. It's not efficient in any way. But certainly is faster.
@0LoneTech
@0LoneTech 6 жыл бұрын
Yep, this tradeoff between polling and interrupts does exist! Interrupts cause a context switch, which involves saving some state and jumping to another routine, possibly waking up a CPU that was sleeping entirely. Spinning the CPU on a single task can achieve faster reaction times on many, but not all, processors (the exceptions tend to have hardware contexts, like SPARC register windows, ARM fast interrupts or XMOS threads). The point I was making is that the CPU receives the interrupt when the message has arrived; it is not involved while the keyboard is transferring, and does not need a round trip to interrogate the keyboard. It's more like the mail man leaves the note at the desk you're already working than you answering the bell. (On PS/2, there's a high risk the CPU is fast enough to switch back and forth for each byte, which can get costly as many messages are several bytes long.)
@dipi71
@dipi71 6 жыл бұрын
On modern computers, USB driver stacks and USB controller chips connected via PCI to the rest of the chipset handle that type of packet- and event-driven communication. It’s a whole other level of complexity (for example, I have a keyboard with USB hub where a USB wireless mouse and thumbdrives are connected). Then there’s all kinds of graphics drivers, font-rendering algorithms, window-management software modules and other complications to traverse for the key press (or key release) to do something useful. The more you dig into these kind of things, the more the mind boggles!
@pierreabbat6157
@pierreabbat6157 6 жыл бұрын
On the Apple ][, if you press 1, 2, and 3 at the same time, it would also get an S, or something like that.
@DanielPianoful
@DanielPianoful 6 жыл бұрын
How dare you saying that about the beloved, eternal, all clacky Model M. Heresy!
@albertwilliams5532
@albertwilliams5532 4 жыл бұрын
Your are doing a great job! One recommendation, English subtitles please..couldn't get the accent right!
@Jonathansyoutube
@Jonathansyoutube 6 жыл бұрын
If I heard him correctly, 2 to the 100 keyboard combinations is a number greater than the number of atoms in the universe.
@TheRealFaceyNeck
@TheRealFaceyNeck 6 жыл бұрын
The only thing missing from this video is Dr. Bagley literally dropping a microphone and walking off set.
@RamkrishanYT
@RamkrishanYT 6 жыл бұрын
make a second video explaining the software sides of it
@stopthephilosophicalzombie9017
@stopthephilosophicalzombie9017 6 жыл бұрын
I would have liked to see more on the software side.
@miran248
@miran248 6 жыл бұрын
Anyone remember the times where you could push (at most) three keys simultaneously? :) My first computer would at that point freeze for the duration of beep (from the speaker at the bottom of the computer case) repeatedly until some keys were released.
@neatoelectro3687
@neatoelectro3687 6 жыл бұрын
I had forgotten all about this. . . then you mentioned the beep.
@mannyknowles
@mannyknowles 6 жыл бұрын
Questions about the fanfold greenbar paper used in so many of these videos. Why/how do they have so much of it? Are they using up leftover/surplus inventory from a bygone era? Are there still dot matrix printers in use at the university? I'm dying to know.
@rajpatel5846
@rajpatel5846 6 жыл бұрын
You guys make awesome knowledge videos
@AndresRodriguezGuapacha
@AndresRodriguezGuapacha 6 жыл бұрын
Off topic, but can you create a video about the SWARM robots project from Rolls Royce, the Universities of Nottingham and Harvard for car engine inspections?
@unlokia
@unlokia 6 жыл бұрын
What's the ASCII code for the "Any" key?
@neatoelectro3687
@neatoelectro3687 6 жыл бұрын
I don't see any any key!
@PeterNerlich
@PeterNerlich 6 жыл бұрын
How does the computer handle multiple keyboards? Can I tell it to ignore the numlock setting (and regard it as always on) for one specific keyboard only? Do I have to write my own Linux driver for that?
@lawrencedoliveiro9104
@lawrencedoliveiro9104 6 жыл бұрын
2:06 Or there would be, if your hardware implemented “n-key rollover”, which means it can distinguish every possible combination of keys being pressed at once. Not sure if current keyboard hardware actually supports that.
@kranser
@kranser 6 жыл бұрын
You mentioned when a key is released, the hardware would send a signal to the computer to say a key release event has happened - but how does the HW know a key is released, would it not need some kind of memory to check which keyboard link lines were being pressed at the previous scan?
@0LoneTech
@0LoneTech 6 жыл бұрын
Quite right! That's part of what the program in that microcontroller handles. USB keyboards process things slightly differently, in that they report a list of currently pressed keys instead of press/release events.
@kranser
@kranser 6 жыл бұрын
Thanks LoneTech. So the microcontroller is part of the keyboard, am I correct? So the Computer OS does not need to monitor for key presses, just wait for a key pressed/released interrupt event, yes?
@hydrochloricacid2146
@hydrochloricacid2146 6 жыл бұрын
kranser correct. Seperate interrupts are sent for key press and release.
@johntitor3860
@johntitor3860 4 жыл бұрын
you don't need a microcontroller though, you can scan using a 555 timer and counter IC, then run the result of the matrix through various logic gates to create a binary code output, I guess this could get quite complex when dealing with a computer keyboard, I have only done it with a numeric keypad. Anyway I guess then what happens is the result updates a register, and whenever a key press is detected to have occurred, an interrupt is sent to the CPU periodically, the CPU then reads your keyboard register when it wants to.
@1st_ProCactus
@1st_ProCactus 6 жыл бұрын
huh, The video was cut short. I assume there is a part 2.
@ashleyjaytanna1953
@ashleyjaytanna1953 3 жыл бұрын
Somewhere out there when a key is pressed.... a paradise
@ErikN1
@ErikN1 6 жыл бұрын
I'm curious about why there is a swedish keyboard there. Seems a bit random, but being swedish myself I like it. What's the story?
@RaymondHng
@RaymondHng 6 жыл бұрын
The Swedish keyboard layout has keys to generate the letters å, ä, and ö. Norwegian and Danish keyboard layouts generate å, ø, and æ.
@ErikN1
@ErikN1 6 жыл бұрын
@@RaymondHng well, yes. But why does British computer science guys need that?
@RaymondHng
@RaymondHng 6 жыл бұрын
Maybe he knows Swedish.
@ErikN1
@ErikN1 6 жыл бұрын
Det är möjligt
@JohnnyThousand605
@JohnnyThousand605 6 жыл бұрын
3:45 shots fired! XD
@Seryosin
@Seryosin 6 жыл бұрын
Press F to Pay Respects
@patsonical
@patsonical 6 жыл бұрын
Part 2 when? I wanna know how a UNIX system handles these
@marcel151
@marcel151 4 жыл бұрын
Just how any other OS handles it? Throw a keymap on it and display the pressed key.
@aurorathepuppymoth
@aurorathepuppymoth 6 жыл бұрын
A letter appears on the screen. Next question.
@gman6055
@gman6055 6 жыл бұрын
Lauren Hahn end of story, video length = 2 seconds. 12 minutes and 26 seconds saved :) genius
@arthurmarek8418
@arthurmarek8418 5 жыл бұрын
Lineprinter paper! Reminds me of computer science A level in the seventies...cool!
@sameyers2670
@sameyers2670 6 жыл бұрын
Is there a reason why the QWERTY format was chosen for keyboards?
@romaliop
@romaliop 6 жыл бұрын
It's a leftover from the mechanical type writer era. The letters were "scrambled" in a way that would minimize the amount of mechanical failures when pressing two letters next to each other in rapid succession(the pattern was optimized for the English language). The common myth says that it was to slow the typists down, but in fact it was to speed them up through less time spent on malfunctions and it doesn't really have an effect on typing speed after the typist gets used to it.
@sameyers2670
@sameyers2670 6 жыл бұрын
romaliop Thank you
@FabianMendez
@FabianMendez 6 жыл бұрын
"I love my keyboards soft and mushy" You should be ashamed of yourself!!!
@xymaryai8283
@xymaryai8283 3 жыл бұрын
what if I handbuilt a custom membrane keyboard? im already doing 90% of what the mechkeys community wants, is that enough to leave me alone? XD I do actually want to build a custom keyboard with some nice soft tactile switches, but they don't exist in the same form factor as cherrys or kaihls
@lesthompson608
@lesthompson608 6 жыл бұрын
There are different codes called make and break codes for when a key is pressed vs released.
@xotmatrix
@xotmatrix 6 жыл бұрын
"I like my keyboards like I like my peas: soft and mushy."
@g3n3ricnam35
@g3n3ricnam35 3 жыл бұрын
Just near the end when you spoke about how the OS handles input, would it be possible (not practical) to leave a computer without resources by using keyboards?
@myusernameskitty1230
@myusernameskitty1230 3 жыл бұрын
dangit now i cant type how helpful this is
@lawrencedoliveiro9104
@lawrencedoliveiro9104 6 жыл бұрын
3:34 What about “buckling spring”, e.g. Cherry MX switches?
@jackodonnell3463
@jackodonnell3463 3 жыл бұрын
Based on that fly shirt, I suppose the stereotype of computer scientist's being fashionably obtuse is only an American thing
@Kersich86
@Kersich86 6 жыл бұрын
Appropriate quake reference is appropriate😀
@CarterColeisInfamous
@CarterColeisInfamous 6 жыл бұрын
1:58 but the wires are multiplexed
@InTheBeginningTheUniverseWas
@InTheBeginningTheUniverseWas 6 жыл бұрын
from the title I expected a video about polling and interrupts... got a video about how keyboards work??
@okaro6595
@okaro6595 6 жыл бұрын
When euro was introduced they actually sold new keyboards for people by saying that it has the euro character.
@DerUnbekannte
@DerUnbekannte 6 жыл бұрын
In this line scanning model, what happens when I press a key in the current row, one below on the same column, and one more on the same row as the second key. Do I get a false detection on the scanned row?
@okaro6595
@okaro6595 6 жыл бұрын
In the DOS era the interrupt just interpreted the scan code and put the scan code and the ASCII code in a buffer and then it was for the software to check if there were characters in the buffer. Is it somehow more sophisticated with Windows?
@gdclemo
@gdclemo 3 жыл бұрын
In Windows, the currently focused window gets sent a message when a key is pressed. There is WM_KEYUP and WM_KEYDOWN for the "key pressed" or "key released" messages (including repeats if you hold down a key) and WM_CHAR when the OS converts one or more keypresses into a character, depending on the current language (this can get very complicated for languages with lots of characters like Japanese). The application typically passes control to the OS and asks it to wake it up when there's a new message for it.
@FriedEgg101
@FriedEgg101 6 жыл бұрын
You would hate my keyboard; pbt double shot keycaps on metal base with MX greens :)
@MsHojat
@MsHojat 6 жыл бұрын
I hope you're not gaming on green; seems like a bad choice. Heck green seems unnecessary for anything.
@FriedEgg101
@FriedEgg101 6 жыл бұрын
I do game with green, but I mostly use push-to-talk so it's cool. I love the feedback and the clack when typing. I used blues for years, but when I heard about greens I had to try them, and I love them. Have you tried typing on green? So fast and satisfying. I can't even find my keyboard (vortex pok3r) with the option for green switches anymore, so I consider it a limited edition :)
@ChrisWMF
@ChrisWMF 3 жыл бұрын
What if the user is a gamer and they need the computer to know that several keys are being pressed at the same time. Isn't there some cases where some key strokes can confuse this system since they overlap in the key matrix?
@xYuki91x
@xYuki91x 3 жыл бұрын
say I press 3 keys at the exact same time of which 2 are on the same line vertically and the other one is in the same line horizontally with one of those. How can my keyboard know if I pressed 3 keys and not only 2? Or perhaps I even pressed 4 keys at the same time? How can it tell the difference?
@b1aflatoxin
@b1aflatoxin 6 жыл бұрын
Hmmm, what about keyboard polyphony? From experience, even cheap keyboards have 5 key polyphony (five key-presses can be performed at the same time). ??? I'm thinking it has to do with the microcontroller being able to differentiate between micro-second delay times that out brains and hands can not. ??? _Edit:_ This question stems from my experience with DAW's and VST's in music production. After thinking about it more, ...it's probably a software thing. ;) But I'm still curious.
@maxemore
@maxemore 3 жыл бұрын
This guy offended an entire group of pc users at once by saying he likes keys soft and mushy
@TheTurnipKing
@TheTurnipKing 6 жыл бұрын
I'm not actually certain but I think the modern rubber dome keyboard probably owes a fair bit to the design of the Sinclair keyboard.
@Tevildo
@Tevildo 6 жыл бұрын
TheTurnipKing - The first computer with a chiclet keyboard was the Interact Model One (1978). Virtually everything that came out in '82 and '83 had one, so singling out the Spectrum is a little unfair.
@TheTurnipKing
@TheTurnipKing 6 жыл бұрын
@@Tevildo the Sinclair machines are neat though because you can see the evolution from bare membrane in the ZX80, to the rubber mat over membrane to the plastic key over rubber mat over membrane that characterises modern keyboard design
@ProgrammingP123
@ProgrammingP123 6 жыл бұрын
8:23 to 8:47 IS he talking about CPU interrupts at this point?
@NilayInel
@NilayInel Жыл бұрын
Neden türkçe altyazı sadece 2 dk var ancak oraya kadar izler diye mi düşündünüz yoksa 2. dk dan sonra İng. mi anlamaya başlamamız gerekiyordu:
@christianmonturanoii6539
@christianmonturanoii6539 Жыл бұрын
How do they mold the shape of the letter under rhe keyboard ? I don't know how to ask this question it's hard to find aomone that can explain. So when a computer is built how do they mold all the letters into the computer so that when I press the letter x it shows up on the screen there isn't a little mold of rhe letter x under the button lol how do rheu fiest get the symbols to show up on the screen from the keyboard?
@altimmons
@altimmons 6 жыл бұрын
Considering that a usb bus is still very definitely 5V, it’s probably still 5V not 3.3.
@thedawnofslayer
@thedawnofslayer 6 жыл бұрын
subtitles... where you are?
@dstinnettmusic
@dstinnettmusic 5 жыл бұрын
Not flaming, but I prefer a nice clicky-clacky keyboard and don't understand how anyone could want mushy quiet one.
@hamditrimech9299
@hamditrimech9299 6 жыл бұрын
hi, I would like to develop a language pack, then add an engine work in the background, which will works like a sentences corrector, all what I found is about how to install a language pack, any idea where to start ? .
How Software Deals with Key Presses - Computerphile
12:01
Computerphile
Рет қаралды 72 М.
How does a USB keyboard work?
34:15
Ben Eater
Рет қаралды 3,3 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
Programming in PostScript - Computerphile
15:22
Computerphile
Рет қаралды 247 М.
All the Numbers - Numberphile
14:27
Numberphile
Рет қаралды 1,6 МЛН
CPUs Are Out of Order - Computerphile
15:09
Computerphile
Рет қаралды 188 М.
GUI: Under the Hood - Computerphile
17:26
Computerphile
Рет қаралды 154 М.
This digital piano has some very clever controls
17:28
Technology Connections
Рет қаралды 1,1 МЛН
I built my own 16-Bit CPU in Excel
15:45
Inkbox
Рет қаралды 1,7 МЛН
Where did Bytes Come From? - Computerphile
11:31
Computerphile
Рет қаралды 481 М.
If
13:23
Vsauce
Рет қаралды 17 МЛН
How To Start An ISP (like it's 1993)
16:54
The Serial Port
Рет қаралды 204 М.
Playing Music on the Oldest Running Computer in America!
27:06
Usagi Electric
Рет қаралды 352 М.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН