What is bit in simple computer language
3.4 Texts with zeros and ones
3. Zeros and ones
In the introduction there was such a strange suggestion that all the great things that you might have already done with your computer, such as painting pictures, writing texts, etc., are nothing more than calculating with zeros and ones for the computer.
In the previous chapters we have already seen how the computer represents numbers with zeros and ones (see Table 2 to Table 5). A certain number is assigned to a certain bit sequence - naturally in such a way that it also makes mathematical sense, namely in the same way as we count in the decimal system.
Nobody prevents us from assigning a letter to a bit sequence instead of a number, does it? Why shouldn't 01000001 mean "A" instead of "65"?
Let us look again at the addition (the plus calculation) that our super-simple computer carried out in Section 3.1: The result, i.e. which lamp came on when, only depended on how the switches were set, i.e. which ones Input we made, and how our computer was wired - you could also say programmed - was. For the circuit, it didn't matter what meaning we assigned the switch positions or the lighting of the lamp (s); it conducted the current as the wiring was. It was only we who made the wiring exactly so that the meaning of our result matched the meaning of our input! That sounds like cheating now, but it's not! This is exactly how a real computer works!
We can now come up with a simple task for editing texts, for example we could want to turn a capital letter into a small letter and vice versa. So that our computer can do this, we only have to determine which bit pattern corresponds to which letter, and then we have to think about a wiring that generates the corresponding bit pattern of the lower case letter on the output side (lamps) for each capital letter bit pattern on the input side (switch), or vice versa.
It's easier than it sounds!
Let's start with the definition of the letters: If we stick to the eight bits that the inventors of the computer agreed on at some point, then we can represent 256 different characters. The alphabet has 26 letters; they are available in large and small letters, that makes 52 pieces together. Then there are the umlauts ä, ö and ü in large and small as well as the "ß". We'll probably also want to write whole sentences with our computer one day; for this we also need punctuation marks such as full stop, comma, exclamation mark, etc. and at some point we will certainly find it great to be able to use strange characters like%, , $, &. In addition, there are certainly computer fans in other countries who need other special characters. But for the beginning, 256 characters will be enough for us!
It makes sense that all computers use the same assignment of letters to bit sequences, because otherwise a text written on one computer would have a completely different meaning on another computer and this sentence might look like this:
Kl43jsdc l rlk 2ehr Es'fhg e4 $ "öoijh rfghElSöfdh verjhgo i reobjGRnSh oer ergPner oer rönkFGbjs.renor ihg9h 25QQnön548p 5gi uARsfd
To prevent that from happening, it was agreed on the common definition in Table 6, which one ASCII named.
ASCII is an abbreviation and means "American Standard Code for Information Interchange". This is English and means in German: American standard code for the exchange of information. Although the name says "American", it is used all over the world.
A code is a Assignment from character to other characters or to a specific meaning.
Table 6: The ASCII code
Don't let the table confuse you! Three columns, separated by a space, belong together: on the left is the decimal number, then the bit pattern of eight bits that corresponds to this number comes, and in the third column is the letter or character that has been assigned to the bit pattern .
You can find our letters A to Z and a to z in the area with a blue background.
If you look carefully, you will notice that not all 256 possible bit patterns are shown in the table (e.g. 1 to 31 are not). This is because they are filled with something that cannot be printed, such as characters that tell a printer to take a new sheet or start a new line. Something like that is called Control characters.
The character assigned to zero and the character for 32 look the same in the table, but they are not: The zero really means Nothing, and 32 is the code for a space.
You may notice something else strange about the table: It also contains bit sequences to which the digits 0 to 9 are assigned. You are in the area with a yellow background.
What do we need that for? We already represented numbers with zeros and ones in chapter 3.2! Why are we doing this again here, and with a different assignment than we had before? The "9" in the ASCII table is "00111001" and not "00001001" as we would have written it when calculating! Now the answer is this: Even when writing a text we want to be able to write our digits; Only in this paragraph, which you have just read, do the digits 0, 1, 2, 3 and 9 appear, but we do not want to calculate with them in the real sense. After all, the people who came up with the ASCII table were so smart that the right half (the right nibble) of the bytes used to represent digits is identical to the mathematical coding of the numbers: the right four bits of ASCII Codes for the 9 are called 1001 and that corresponds exactly to the pattern that results when we count to nine with zeros and ones. Written in hexadecimal (see chapter 3.3!) Is the ASCII code for the digits 0 to 9: 0x30, 0x31, 0x32, ..., 0x39; the right digit of the hexadecimal number therefore always corresponds to the digit shown.
Back to our task: Our computer is to convert the bit pattern of an upper case letter into the bit pattern of a lower case letter. Here, too, it is worth taking a closer look: Uppercase and lowercase letters are identical in their bit pattern, except in the sixth position from the right! Upper case letters have a zero, lower case letters have a one.
The computer that can cope with our task only has to transfer the bit pattern from our eight input switches to the output lamps. Lamp number six must light up if there is a 0 on the input page and must be switched off if there is a 1 there.
Figure 9 shows a computer that can do this. The conversion from "M" to "m" is shown. (Find the bit pattern for m and for M in Table 6!)
| Figure 9:|
Computer that converts from upper case to lower case and vice versa
The switch for bit no. 6 (arrow) is in the "zero" position, ie up. Nevertheless, he conducts the electricity. If we were to convert from "m" to "M", we would have to push this switch down to position "one"; in this position the cable would be interrupted so that a zero appears on the output side. The bit is said to be inverted, i.e. reversed: The opposite of the input (switch) is always at the output (lamp).
A second special feature: Our computer would actually only need six switches and six lamps for this task, because bits number 7 and number 8 are always set to zero and one for both uppercase and lowercase letters (see Table 6). If you were to actually use our computer and enter letter codes with the switches, you might find that you never had to turn those two switches.
And indeed: old teleprinters, devices that used to be used to transmit texts over a telephone line, only worked with five bits: They did not differentiate between upper and lower case and could display 32 different characters with five bits. These devices are no longer needed today; the fax has completely superseded them!
Our computer for converting from upper to lower case and vice versa works in any case!
That was pretty much theory now and you probably don't even think that something like this works in a real computer. If you have a PC, you can try it out right away! Let someone help you if the instructions aren't clear to you, or read on first; everything that seems strange to you and you don't understand will be explained later!
ASCII codes are hidden in the PC!
Where which button is located is shown in Figure 10!
|Figure 10: PC keyboard|
If you use ASCII codes greater than 127 in this attempt, you may see different characters than those shown in Table 6. The reason for this is that there are different versions of this upper half of the table (code number 128 to 255), because the 255 possible characters were not enough and you can change this part of the assignments.
What does this experiment show us? Now: The computer interprets your number entry according to the assignment shown in Table 6. So it was programmed into him. In the past, this method was used with the Alt key to enter characters into the computer that were not on the keyboard. Today almost every program offers a more convenient way to enter such special characters.
But at least you are now sure that your computer correctly understands our assignment of letters and characters to zeros and ones!
Another small note: Although you enter the same numbers with the numeric keypad as with the other number keys, your computer distinguishes these keys! You can tell by the fact that the experiment with the other number keys does not work!
- Can we root an iPhone?
- Who was America's first notoriety
- What's big SMALL in smartphones
- How do IITians raise their children differently?
- How reliable are modern super sports cars
- Why do certain subwoofers fire
- You can reverse the retinal reading
- Are there atoms in a vacuum
- There is a loop in C language
- Can I apply for car model insurance?
- Why do people seek conquest
- Is chocolate considered a dairy
- What is the National Passport of Pakistan
- What do you think of clinical pharmacy
- Why do Indian parents compare their children
- Does uncontrolled economic globalization damage the environment?
- Is household garbage worth the money
- What are the characteristics of Chicago
- Bondi Beach has good surfing
- What is BOQ parts list
- How did Jackie feel about JFK's death
- With whom does Armenia have bad relations?
- What is Paul Harvey famous for?
- Which topic is required for IPMAT