Pressing a key
The key is pressedAs the key is pressed, a switch closes and current flows into a small chip in the keyboard. Each key on the keyboard has an associated number, called a scan code. The number is based on where the key is on the keyboard. This is useful when it comes to keyboards that have different layouts and/or symbols. This scan code is sent into the computer as a binary number.
A number is transmitted to the CPUThe binary data is transmitted from the keyboard into your computer.
Want to keep
Raspberry Pi Foundation online course,
Understanding Computer Systems
The data is interpreted by the operating systemRemember, the CPU is running the operating system. The operating system is constantly checking for key presses. It may look like it’s sitting there doing nothing, but the operating system must react immediately to key presses, so it has to be ready for them all the time.
An event is created by the OS and captured by application softwareThe operating system will convert the scan code into an ASCII or Unicode character based on the key pressed. You typically set the keyboard layout for your computer in the operating system, so it is the operating system that will know what letter is represented by, say, scan code 1 in this language/keyboard layout. The OS creates an event depending on the resulting character. In computing, an event is an action that is recognised and handled by the software. It often originates from the hardware. The OS must now send the event to the appropriate application. Many different applications are running, and the key press must be handled by the right one. The OS knows what software was active when the key was pressed, and sends the event to that application. The application software in this example is Microsoft Word. It captures the event from the operating system.
The application software displays the character on the screenMicrosoft Word converts the character into an image based on your font choices in Microsoft Word. It sends this image, as a binary representation, back to the CPU, which sends it to the GPU. The GPU translates the binary code into an image and displays it on the monitor. A lot happens when you press one key. The main devices we’re going to focus on in the next few steps are input and output devices. Can you work out which device is the input and which is the output in the scenario above? Can you work out what is hardware and what is software? Share your answers in the comments.
Understanding Computer Systems
Our purpose is to transform access to education.
We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.
We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.