Binary & data
Adafruit founder Limor Fried and program manager Federico Gomez Suarez explain how computers represent numbers, text, images, and sound using tiny electric signals.
Want to join the conversation?
- Is Binary 0 and 1 in Computers like the DNA for Humans except computers use Binary to function the data and information?(38 votes)
- Binary is more like the smallest building blocks of information (just a 1 or 0). Its how they are strung together that gives the computer instructions and may be closer to DNA since DNA gives our bodies instructions. Binary by it self seems to be closer to atoms (Building blocks).
Algorithms may also be compared to DNA since they are instructions that tells the computer what to do with the input in order to give output. Really there is no perfect comparison, life and nature are still much much more sophisticated and complicated than even the most advanced computer...so far ;-)(38 votes)
- with three numbers (rrr, ggg, bbb) you can describe 16 777 216, isn't it enough?
Anyway, human eye can distinguish about 10 millions colors (10 000 000), so being able to use more numbers to describe colors would be a wasteful use of memory.
Using one less wire would mean having 127 as the max number, and so having 2 097 152 colors, which is not enough(47 votes)
- Is it possible instead of making a computer with switches being either 'on' or 'off', can you make a 'three-way switch' that has 3 different settings like 0, 1, and 2?
Even better, can computers use
hexadecimalinstead of binary? Wouldn't it be much more efficient to store information like that?(12 votes)
- Computers process the binary data via electrical pulses. To represent a 0, we have no pulse, and a 1, we a pulse. If we wanted to have more numbers added, we would use different magnitudes of pulses. However, the transistors are so good they can't quite detect magnitudes of pulses that well, but really can only detect the presence of one. To make it easier to detect the magnitudes, we could have the voltage be higher. But, if the voltage is higher, so is the energy consumption of the computer. For this reason, computers just stick to the simplest number system they can, binary.(44 votes)
- if text and photo and video converts to binary, that means everything become binary, so how computer know which is text and which are photo ?(12 votes)
- From the author:Good question! We discuss that more here:
Basically, every file has a "header" at the top, and that header provides information about the contents of the file, like it's file type.
An application can look at a file header to determine if it understands the file type and can open it. For example, a text editing application can't open photos, so it will look at the file header, see that it's a type that it doesn't understand, and then tell the user "sorry, can't open that!". A photo editing application will look at the file header, see that it's an image type that it understands, and then render the pixels for the image.(15 votes)
- After input is given to computer , it will store in the form of 0's and 1'S . Before displaying output how the computer knows that particular combination of binary digits related to image or text or video?(3 votes)
- Often, files containing binary data will have a "file signature" at the front of the file which gives a clue to what the data is. For example for a PNG image file the first 8 bytes are:
The first eight bytes of a PNG file always contain the following values:
(decimal) 137 80 78 71 13 10 26 10
(hexadecimal) 89 50 4e 47 0d 0a 1a 0a
(ASCII C notation) \211 P N G \r \n \032 \n
So an image program could look at a file with this signature, and know that is probably a PNG file. However, you could still open that file up in a text editor and display it as text (most of it, other than the file signature would look probably look like random text), or you could try to play it as an audio file (it would probably sound like static).
Some programs, will just give you an error message, if it looks for a file signature and doesn't find anything that it recognizes.(16 votes)
- From3:50of this lecture(i.e. Text in Binary), we learned that we can assign a number to each letter (The ASCII and Unicode System).
Now one question is troubling me a lot, In ASCII letter 'A' is represented by Decimal 65 and in Binary it will be 01000001 and this binary 65 (01000001) will be stored as a letter 'A' in computers memory, to be outputted by the monitor.
But at the same time the same binary (01000001) means a numeric 65.
How does CPU know when to represent (01000001) as letter 'A' and when the number 65?
Please make it clear to me and I shall be very much thankful to you.(5 votes)
- Those bits can be letters, colors, numbers, pictures, or just about anything else you can think of. It is our choice on how we interpret the data.
Often, for data files, we put some special string of bytes at the beginning of the file (a header), and also we add a file name extension e.g. .pdf, .jpg, etc. to give programs a clue on how we want them to interpret the data. However, those programs can choose to interpet that data in any way that they want e.g. you could try to display a text file as a picture (it would probably just look like a bunch of random pixels)(10 votes)
- How do they use quantum computers that give off both a 1 and a 0 at the same time?(9 votes)
- Does every coding language use and/or is made up of binary?(3 votes)
- Some coding languages are coded in language humans can interpret, but then they are compiled into computer language/binary.(3 votes)
- how are pictures on the internet in color if everything is a 1 or a 0? shouldn't everything be in black and white?(2 votes)
- Good question! Color images use multiple bits to represent each pixel - typically 24 bits, with 8 bits each for the red, green, and blue components. Those 24 bits can represent more than 16 million colors.(9 votes)
- What is virus ?(4 votes)
- A virus is a specific type of malware that modifies other programs and infects them.
All viruses are malware, but not all malwares are viruses.(2 votes)
(upbeat music) - Hi, my name is Limor Fried, and I'm an engineer here at Adafruit Industries, and this is where I do engineering and design, and I design circuits for fashion and music and technology. - My name is Federico Gomez Suarez, and I'm a software developer with Microsoft Hack for Good, and I look into using technology to help solve some of the big social problems of our times. (upbeat music) - You may have heard that computers work on ones and zeroes, or you may have seen scary-looking visuals like this. But almost nobody today actually deals directly with these ones and zeroes, but ones and zeroes do play a big role in how computers work on the inside. - Inside a computer are electric wires and circuits and carry all the information in a computer. How do you store or represent information using electricity? - Well, if you have a single wire with electricity flowing through it, the signal can either be on or off. That's not a lot of choices, but it's a really important start. With one wire, we can represent a "yes" or a "no," true or false, a one or a zero, or anything else with only two options. This on/off state of a single wire is called a bit, and it's the smallest piece of information the computer can store. If you use more wires, you get more bits. More ones and zeroes with more bits, you can represent more complex information. But to understand that, we need to learn about something called the binary number system. (calm music) - In the decimal number system, we have 10 digits from zero to nine, and that's how we've all learned to count. In the binary number system, we only have two digits, zero and one. With these two digits, we can count up to any number. Here's how this works. In the decimal number system we're all used to, each position in a number has a different value. There's the one position, the 10 position, the 100 position, and so on. For example, a nine in the 100 position is a 900. In binary, each position also carries a value, but instead of multiplying by 10 each time, you multiply by two. So there's the one's position, the two's position, four's position, the eight's position, and so on. For example, the number nine in binary is 1001. To calculate the value, we add one times eight, plus zero times four, plus zero times two, plus one times one. Almost nobody does this math because computer do it for us. What's important is that any number can be represented with only ones and zeroes, or by a bunch of wires that are on or off. The more wires you use, the larger the numbers you can store. With eight wires, you can store numbers between zero and 255. That's eight ones. With just 32 wires, you can store all the way from zero to over four billion. Using the binary number system, you can represent any number you like. But what about other types of information, like text, images, or sound? It turns out that all these things can also be represented with numbers. (upbeat music) Think of all the letters in the alphabet. You could assign a number to each letter. "A" could be "1," "B" could be "2," and so on. You can then represent any word or paragraph as a sequence of numbers, and as we saw, these numbers can be stored as on or off electrical signals. Every word you see on every webpage or your phone is represented using a system like this. (upbeat music) Now, let's consider photos, videos, and all the graphics you see on a screen. All of these images are made out of teeny dots called pixels, and each pixel has color. Each of the colors can be represented with numbers. When you consider that a typical image has millions of these pixels, and a typical video shows 30 images per second, now, we're taking about a lot of data here. (upbeat music) - Every sound is basically a series of vibrations in the ear. Vibrations can be represented graphically as a waveform. Any point on this waveform can be represented by a number. And this way, any sound can be broken down into a series of numbers. If you want higher-quality sound, you will pick 32-bit audio over 8-bit audio. More bits means a higher range of numbers. - When you use a computer to write code or make your own app, you're not dealing directly with these ones and zeroes, but you will be dealing with images, or sound, or video. So, if you want to understand how computers work on the inside, it all comes down to these simple ones and zeroes and the electrical signals in the circuits behind them. They are the backbone of how all computers input, store, process, and output information. (upbeat music)