Let's Make Robots!

To understand the in depth working of microcontrollers (and computers in general)...

This topic has been in my mind for a long time and my recent reading (this book) has made it even more worthy a question for me to ask-

What is puzzling me is that I know how a computer language (C++ in my case) works and I also know how basic electronics like diodes, resistors, transistors etc. work but what is the link between a language and electronics. How is an electronic device able to do the jobs such as copy, paste, move etc.

What I know- Languages are translated into binary or machine language by devices called compilers/interpretters (and assemblers in simpler languages). This binary code somehow is able to do our job. Assemblers/compilers/interpretters are themselves written in machine code(most probabaly).

Questions I need answered- How is this binary code doing our job? What kind of circuit is able to do the job? What all kinds of circuits do we need? What is an instruction set?

By understanding how the simplest computer works, I want to understand the working of all devices from microcontrollers upto the latest INTEL processors. The problem is, I'm missing the basic knowledge. I know a bit about what VLSI is and a bit about what Integrated Circuits are (a compact package of thousands of electronic components like transistors). Problem with my knowledge is that I need to know if someway I aquire a thousand odd transistors, how can I convert it to a working computer? Then again, if I'm able to wire everything up perfectly, how'll I be able to access it to perform the most basic jobs like read a file, store it, execute it etc. And for those who'll say that why use a thousand transistors, the answer is simple- I want to build my way up (or down because as technology grows, size tends to decrease). 

The simplest computer (or micro computer) I have are 12 of the idle ATMega 328PU chips I ordered from Atmel but never got around to use due to lack of materials. I can easily spare 6 of them for hacking. The next step is my INTEL Core2Duo processor and then the INTEL Core i5 processor which are to complex for me to hack and understand. So, it'll be the best if I understand the basics at ATMega.

Thanks in advance for your effort!!


UPDATED- 3/11/2012

Thank you everyone for your reply!! I didn't have my internet working for a few days so I couldn't come around to check the replies. As there are a lot of replies, it'll take me some time to read though everyone's reply (including the links they posted) and if you allow me, I'll keep on bugging you with questions.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

You could always try something like this...

http://hackaday.com/2012/04/20/building-a-computer-with-discrete-transistors/

I'll admit to thinking about building an Altair or Apple I clone lately, but not seriously!  I can barely commit to a night of drinking these days.  In that photo I only count 62 transistors and about twice as many resistors-I'd get the parts and then go "Eh, I'm too tired/my stomach hurts to much today..."

But if somebody wants to do it I'm right behind you!

Not to dampen your spirit but if you aim to build your own microcontroller from transistors then you have lot of soldering in front of you. Your ATmega microcontroller probably has about 20-50,000 transistors in it and your Core 2Duo clocks inn at about 300,000,000
Even the old 4bit Intel 4004 had over 2000 transistors and that is just the cpu and you need to add some RAM an ROM.

There are probably great books out there about assembly programming that would get you under the hood of what is going on in a cpu. But digging further down and try to understand what’s going on in every AND gate would probably be rather hopeless (and in my opinion rater useless).

Also I’m not certain that I follow your definition of hacking. In my book, hacking means taking a device and modify / changing it to do something else than it was intended to do. How will you ‘hack’ a microcontroller?

This video explains things quite well and is worth a look.

http://www.youtube.com/watch?v=WIDzNyfVVg0

Each transistor in an Integrated Circuit (IC) chip or microcontroller has many, many transistors. Each transistor can be on or off, representing a logical ON or OFF, binary 0 or 1. Groups of transistors can be used to make special purpose functions. Some functions are built up like Random Access Memory (RAM), Read Only Memory (ROM), Programmable ROM (PROM), etc. These functions are combined to create the circuit and functions of the whole chip.

Processors can be programmed at a hardware level (e.g., assembly), or have higher level programming languages like C++. Computers have operating systems that tie together the processor with all its auxilliary capabilities (drive controllers, Input/Output, etc.)

It is way beyond the scope of a forum post to explain it all. Keep reading and researching, though. I admire your curiosity. It will serve you well.