arduino 8 bit computer
We do that. I want to start by looking at the architecture of the computer in a little bit more detail, So I pull this over here and zoom in a bit, So you can see what we’ve got, and this is kind of the the architecture of the computer And it’s Kind of broken into two sections, So this top section here is organized around this central 8 bit bus and then the bottom section down here is kind of the control logic, So we’ll start with the top section. So this is Central kind of 8 bit bus that all of these different Components are connected to, and what this does is that it lets us kind of move information from any Component to any other component through this through this bus, and so, for example, if you Want to take data From from ram from Memory and put it into the a register. You can do that through this bus, and so what you would do Is you would just say You know, take that that information Ram is going to put that information on the bus and then the a register is going to read that information from the bus. Likewise, if you want to take information from ram and put it into the b register, you could do that. You can say at some point in time that information is going from Ram Onto the bus and then the b register is reading. Whatever is on the bus and putting it into into the b register, So at any point in time You can have basically one thing: putting information on the bus and then one or more things, reading information from the bus and that’s how you move information from One Part of the computer to the other, and so I won’t go through all of these components right now, Maybe in future videos, if you guys are interested, I can.
I can make some future videos going into a lot more detail here, but basically, the way that this is controlled is Saying like if we want to, for example, Load a byte of data from Ram into the a register there’s. This control logic. That is decoding the program that is, that we’ve written that at different points in time, Outputs these these control bits and so, for example, it might at particular point in time output the the ram out bit here and the a in, and Then these correspond here to The ram out and the a in here – and that tells the ram to put that information out and for The a register to read that from in and so we could for example.. We could take information from R And we could put it in a register. We could take another bite from R and put it in the B register. This Al use the arithmetic and logic unit. This is the part of the computer that does various math operations. So, for example, We might have this add the values of a and b, And so then we can tell the alu to put its output on the bus, And then we might be able to read that back into the a register. So we could. You know, for example, put you know one value into a another value into B. Then we could take the sum of those values and then put that back into a And then we could, you know, maybe add another value to B.
And we can keep adding numbers and so that’s. How we might You know, add numbers and then, if we get a result that we want, we could Then tell the a register to put its information on the bus Until the output register to read information from the bus and then that will display the the result Of that computation, So the instructions that the computer understands are are down here. This is a this is actually a list of all the instructions that the computer understands and each instruction has a Sort of a binary value here, Which is which is the actual. You know what we program in the computer if we want to use that instruction And then there’s sort of a monadic here this little three letter, identifier Or two letter that we use when we’re writing the program and then here I’ve kind of called out what each Of these things are So, the first instruction is is a no operation which basically does nothing and as that’s, just more so for testing or something like that. The next instruction is load a which loads, a value from memory, so some somewhere in memory into the a register and then the next instruction is ad, which will add two numbers. So it’ll take a number from memory and add it to whatever’s in the a register and then put the result in the a register is actually what this. What this ad does Subtract is the same thing except it subtracts, Whatever is in in memory from Whatever’s.
In the a register and then puts that result back in the a register Store a is for then Taking data from the a register and putting it back in memory. So we load a and store a kind of compliments of each other, And then the output command takes whatever is in the a register and puts it out on the display. So this is how we get out, but from the computer And then there’s also a jump instruction and a jump carry instruction. So the jump instruction allows us to loop. Yeah, You know create loops in our program. The jump carry allows us to create a loop if the carry flag is set. So if the result of the last addition was Was an overflow, then it’ll jump, otherwise it won’t. So we can create some conditional logic in our programs and then the halt instruction Halts execution. So we do that at the end of the program, so just an example of a program. This is kind of this very, very simple program that we can that we can do in the computer. This program, basically Just adds two numbers together and then outputs the result. So what we’re doing is we’re saying we want to load into into the a register so load a 4, and this 4 parameter Isn’t the number 4, so we’re not putting the number 4 into the a register. What we’re doing is we’re putting the contents of Memory location 4 into the a register That’s, how the load a command works, and so here you can see these are this.
These are the addresses, so the program sits in address is 0. 1, 2 amp 3. So the program itself is 4 bytes long and Then the Data is 2 bytes long and the data are the two numbers that we that we want to add together. So we’re loading into the a register. The contents of Memory location 4, which is the number 14 And that’s just one of the two numbers that we’re going to add this program, is going to add numbers 14 and 28. The next instruction says add The contents of Memory, Location 5, and so what that’s going to do is it’s going to go and take This value 28, which is what’s in Memory, location, 5 and add it to the a register. So the a register We loaded 14 into it now we’re going to add 28, So we’re going to have a total of the sum of these two things which is 42 in the a register. So once we’ve done that the next instruction is the out Instruction and this outputs the contents of the a register to the display, and so once we’ve added the two numbers We want to. We want to put that put that out put on the display so that we can, we can see the result and then the last instruction halts the computer and so that just stops execution. So how do we program this into the computer? So the computer Memory here we can program it in using these dip switches.
But how do we convert this this this Set of instructions into something that we can? We can use our dip switches And so that’s that’s a sort of a step here that we need to do, which is converting each of these. Each of these commands, or each of these what they’re called Op codes into Into binary, that we can that we can input into the computer using the dip switches. And so, if you remember, each of these Op codes has a has a binary thing associated with it. So what we, what We do is this this program here is kind of in a format that we call assembly language, and so the sort of next step here is to do a Process which is called assembling it, which is where we convert the program from Assembly. Language to this binary, Which is the machine language And so the machine language is actually what we can input into the computer and what the computer is going to run because the computer Just understands these ones and zeros, and so the address portion of our program. This is just what address we’re putting each of these commands into so the addresses are 0, 1, 2, 3, 4 amp, 5, so there’s, a total of 6 bytes of memory that we’re using for the program and the Data, and so if we just convert those to Binary, this is 0 1. This is 2 in Binary 3 4, and this is 5 in binary.
So we just convert those addresses the instructions We we go ahead and look over here at what the what the actual binary equivalent of each of these Instruction Op codes is so the load a for example. If we look over here. It’s, 0, 0, 0, 1 and so we’ve converted that here as 0, 0 0 1, the add opcode 0, 0, 1 0 we’ve converted that 0 0 1 0 output is 0. 1. 0. 1. So you see that there and then halt is 1. 1. 1. 1. So you can see we’ve just converted these these Sort of more intuitive use. That word loosely these sort of intuitive opcodes into the binary, and Then some of these Op codes have a parameter associated with it. So the the load, a and the add, both have a memory address that goes with that. So we’re going to loading a with the contents of memory address for When we’re adding the contents of memory address, file five and so that just gets converted over here. So zero one zero zero is just four in binary and Zero one zero one is just five in binary., So that’s just converted over the output and the halt. There’S, no parameter. That goes with that, so we can just put all zeros there and then finally, for the data We’ve got the 14 and the 28 those just get converted to binary. So this is just the binary equivalent of 14.
This is just the binary equivalent of 28, And so once we’ve converted all this to binary., We can go ahead and enter it into the computer. Using these switches Get this out of the way And the way this works is right. Now the computer is in run mode, so we want to. But the clock is stops that’s fine., So we want to convert. We want to switch this over to program mode That’s, just the switch here And when we’re in program mode, we can set the memory address. That we want to program here And then we can set the data that we want to put in to that memory location here, And then we just push this button over here to to actually program it. So we’ll just start where we’ve already got zero: zero zero zero set as the address, so the instruction is zero. Zero, zero one, So we’ll set that one here: 0, 1, 0 0, and so I just set those dip. Switches. So zeroes are down, ones are up, and then I just push this button here and It programs it in and so now we can see that the memory contents are 0. 0, 0, 1, 0, 1. 0. 0. Then we can move on to the next. So 0, 0. 0. 1. Is the address this next address. As soon as I change this address, you see. The memory contents now are all 0, But I can set them so this memory.
I’m just going to set all these switches to zeros. 0. 0. 1. 0. 0. 0. 1. 0. 0, 1, 0, 1. Set those switches push that button and now Location memory. Location 1 is now programmed with with this value and so I’m just going to move along, and the next address is 0 0, 1 0 And the contents of that are going to be zero. One zero one whole zeroes, that’s our output command and then the next address is zero, Zero 1 1 and this is going to be a halt. Which is just one one, one one program that so we’ve got: 1, 1, 1, 1. Ok, so that’s the program, and now we just need to put the data – and this is just going to be the two numbers that We’re adding together.. So you remember, we’re, adding 14 and 28. So in address locations 4 amp, 5, I’m going to put 14 and 28 in binary So 4, 0. 0. 0. 1. 0. 0 is 4. You can see that there and the 14 I’m going to put here it’s, going to be 0. 0. 0. 1. 1. 1. 0: 0 that’s 14. We program that and then finally, the second operand 0, 1, 0 1 is the address and the second operand is going to be 28, which is 0 0. 0. Oh, I think I actually program 28 into address for so let me program 28. Here into address five and Then go back to address 4 and yeah, you can see 28 is in there.
. So really. What I want to do Is change these switches and Program that again and here.. We have it’s four zeros, 3 ones and then a 0 that’s. The 14 so now that’s programmed into address Location 4. Ok, so I think everything is programmed now if I want to, I can go back and check by setting these addresses. So if I go to address 0, I should see the 0 0. 1. 0. 1. 0. 0, I can – and I can just kind of flip through each of these addresses and see what’s in memory, and That looks right Go to the next address. This looks right. If I go to the next address, this looks right and then let me just double check the data, because I think I Almost made a mistake there. So this is the first piece of data and this looks like 14 and then the next final piece of data here this does look like 28 okay, So I think the computer is programmed correctly. So at this point. We can switch it back to The run mode, and you see now the the memories address, Which is here no longer affect what memory we’re looking at, because the rest of the computer is controlling that. So I can zoom out here and let’s. Actually, just try to Run this program and see if it works, and so the way we run it is these switches here reset There’s like three different kind of reset switches that reset different parts of the computer.
So we reset all of that and right now the clock is stopped. But if I start the clock it should go through and execute that program and It looks like it did, and the answer is 42 I’m going to Reset this again and I’m. Actually surprised Did run a little bit slower here. We go., I think this capacitor wasn’t, set in there correctly, so now it’s running a little bit slower and I’m, not sure why came up with 28? Let me reset it again, Run it again And it looks like it got to 42 and it halted yeah. So I think When I first ran it, it ran very fast and I think that’s, because this capacitor, which is Affecting the clock speed, was not set in there properly. So it the clock, ran super fast and just like immediately came up with a computation and then the second time I ran it I’m, not sure why I got that 28. Maybe I hadn’t reset it properly after. I had fiddled with this capacitor, but it looks like now. If I stop the clock, reset everything and then start it, you can see it stepping through and Hopefully it will come up with the same answer again. It looks like it did and then it’s going to go and do the halt and That’s it, and so maybe in the next video.
arduino 8 bit computer Video
arduino 8 bit computer news
Posted on Sunday April 14, 2019Add A Host Of 8-Bit Processors To Your Arduino HackadayNormally when we bring you news of a retrocomputing design, it will centre around a single processor. At its heart will be a 6502, a Z80, or perhaps a 6809. … Continue Reading »
Posted on Saturday August 17, 2019Sensor Lets Gestures And An Arduino Control The Tunes HackadayEvery time we watch Minority Report we want to make wild hand gestures at our computer — most of them polite. [Rootsaid] wanted to do the same and … … Continue Reading »
Kitronik accessory kits for Raspberry Pi, Arduino and micro:bit now available from Farnell – Geeky Gadgets
Posted on Tuesday September 03, 2019Kitronik accessory kits for Raspberry Pi, Arduino and micro:bit now available from Farnell Geeky GadgetsThose new to electronics, robotics and programming mini PC systems or Arduino micro controllers. Maybe interested in a new range of kits providing plenty. … Continue Reading »
arduino 8 bit computer Social