Welcome back to foundations of computer science. This is the first course in the introduction to computer programming with Visual Basic specialization. In this module, we're going to talk about computer hardware and organization. This is the second module of the course, and we're really going to focus on how computers utilize hardware to store data and execute the instructions to carry out our algorithms. In our last module, we discussed all rooms here, we want to think about how that plugs into the hardware of the machine, okay? Some learning objectives for this module. When you're all done, I want you to be able to explain the binary number system. I want you to be able to evaluate some Boolean logic. You should be able to describe computer circuits. You should be able to describe some control circuits. You should be able to list the components of a computer system. I'd love it if you can define the Von Neumann architecture. And lastly, I want you to be able to find some non Von Neumann architectures. All right, so let's jump into lesson one. In lesson one, we're going to talk about the binary number systems. All right, All right, so take a step back and think how should we store data in a computer, right? This is an electronic machine, how can we represent information in electronic machine? So from a requirements perspective, we want to make sure we have clear, unambiguous, and reliable ways of storing the data. Our extra representation is human oriented, all right? So we have a base 10 number system, all right? And think about why that is, how many fingers do you have? Probably most of us have 10, right? That's how we got to the base 10 number system. What I mean by base 10 number system is we start with 0, and we go up to 9, and then we roll over the digit to the next decimal position. And we have keyboard characters, right? We had typewriters before we had computers, and so we took those typewriters, and we applied those keyboard characters over to the computer world. So our internal representation of the computer is going to be computer oriented, how it could do things. And this is going to be base 2. And we're going to encode all of our characters in what we call base 2. So base 2 has two values, and we call that binary. So binary is the simple idea of on and off, true or false, yes or no, positive or negative. And there's lots of ways we store in the computer these values, so it could be in a magnetic disk, it's either charged or not charged. It could be with light, is either a light signal or not, right? It could be electronics, it either electronic charge or not. So we have lots of ways of representing this idea of on or off And binary is important to computing systems because of its stability and reliability, right? Even when an electrical system has a degradation, we can still have a clear on or off, right? It doesn't necessarily have to be the same value, it's either there, or not there. So all data stored inside a computer is stored in binary, we can also call these bits, and we interpret it and display it on the screen in human language. So the binary number system is a base 2 positional number system. So in our base 10, we use the 10 digit, 0 all the way up to 9, each place corresponds to a power of 10. So for example, the number 2,743 can be represented by 2 times 10 to the third plus 7 times 10 to the second plus 4 times 10 to the first, plus 3 times 10 to the zero. Now if it's been a while since you've done math, 10 to the zero, anything to the zero is always 1, right? In a base 2 number system, we're going to use two digits, 0 and 1, and each place corresponds to a power of 2. So for example, the number of 1110 in binary is 1 times 2 to the third plus 1 times 2 to the second, plus 1 times 2 to the first plus 0 times 2 to the 0, right? Again, anything raised to the 0 is 1, right? Which equals 14 in our decimal number system. All right, now we want to think about how we can convert between numbers systems. So converting from binary to decimal, essentially what we do is we add up the powers of 2, where a one appears in the binary number system like we just did in the previous slide. If we want to convert from decimal to binary, we're going to repeatedly divide by 2 and record the remainder, okay? And, that remainder is the digit that goes in that binary system. So here's an example. We're going to take the number 13 in decimal, and we want to convert it by in binary. So we say 13 divided by 2 at 6 but as a remainder of 1, so we use the binary number 1. Now we have 6, we divide that by 2, that's 3 with a remainder of 0, so we put a 0 in the binary digit. Now we take 3 divided by 2, that's 1 with a remainder of 1, ao we put 1 in the binary digit. And we're left with 1 divided by 2, that zero with a remainder of 1, and we put another 1 in the binary digit. So it's 1101 in binary to represent the decimal value 13. All right, so computers are going to use fixed linked binary numbers for integers. So remember integers are whole numbers. So for example, if we're using four bits, this could represent the values 0 to 15 in binary We have a problem, which is what we call arithmetic overflow. So when the computer tries to make a number that is too large, it will overflow that value. So for example, 10 plus 6 with 4 bits is too big of a value, we can't store the decimal number 16 and 4 bits, so that would overflow. All right, so let's look at a little bit of addition here, it's very similar to decimal addition. So for example, 0 plus 0 is 0, right? 0 plus 1 is 1, 1 plus 0 is 0, this is all easy, right? The challenge comes when we carry a value. So remember, in decimal when we get beyond a 9, we carry a 1, same thing here. So 1 plus 1, we're beyond the value 1, so we're going to 0 carry a 1, which is one 0. Okay, here's another example. 0101 plus 0011, we add the two first digit sets. 1 plus 1 is carry a value 1 and we put a 0, so then we got a 1 plus 1 again with a 0, we carry a 1. So it's 1 plus 1, we get a 0 carry a 1, it says 1000. All right, just a little review for this lesson. The binary number system has room for two values per digit. The decimal number system has room for ten values per digit. And we have this problem of overflow, which can occur if we try to store a value that's too large for the number of bits we have. All right, that's it for this lesson, I'll see you in the next one.