Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Inside the Microcontroller!

Status
Not open for further replies.

Electroenthusiast

Active Member
This question has been there in me for a while now. May be you can say that it is over a decade. Just think over, what makes a Microcontroller or a Microprocessor? Any microcontroller for that matter. Even 8051. I mean how does the software and hardware work together. What makes the software instruction work the hardware to process data in a particular way. How does each and every instruction work inside the hardware? How does code manipulate the hardware with the Hardware-Software interface?

How exactly does Microcontroller Hardware interact in such a way to the code that is burnt in to it, such that it makes the hardware work in a particular specific manner?

This has never been taught in my school. But, what is the logic diagram of a microprocessor or a microcontroller?
 
But, what is the logic diagram of a microprocessor or a microcontroller?
It's extremely complicated at first sight, but is mainly built up from a HUGE number of fairly simple gate circuits (e.g NAND gates, NOR gates etc) and latch circuits. The gates combine binary logic signals and the latches store logic states. Those simple circuits are themselves built up from semiconductor devices (transistors and diodes).
 
Look at earlier computers, everything is progressive developments from those.

The "micro" in microprocessor just means the CPU (the "Processor" or central processing unit) is built as an integrated circuit, rather than large numbers of simpler components.

A "Microcontroller" combines a microprocessor with some memory some number if I/O and possibly other peripheral devices in the same IC.


The DEC PDP-8 from the 1960s is great example for learning the concepts - they only have a very few instructions & the very first versions did not use any integrated circuits, just conventional resistors, capacitors, diodes and transistors.
(The "L" or link is what's now called the Carry bit).


For any CPU, the different binary instructions are broken down in to sections.

One section typically breaks down to classes or groups of instructions, to do such things as move a byte or word from memory to the CPU accumulator, move accumulator to memory, increment or decrement, add or subtract etc.

And the most important ones, that technically make it a "computer": comparisons - data in one location greater, less or equal equal etc. to data in another location.

Then depending on that result being true or false, continue with the next instruction or jump to a different part of the program to do something else.

The rest of the binary instruction sets what data, memory address or literal number is being acted on.


If that data location is where a peripheral port or register is, then the instruction could be either reading or setting pin levels, or accessing eg. a serial data UART or timer registers.

Programs, at the "machine code" that the CPUs execute, are just lists of numbers, that represent those various instructions and memory addresses or values etc.
 
Last edited:
Intel 4004 :



i4004-schematic.gif



Regards, Dana.
 
Thanks for the replies. I opened a book on 8051 published by 'Pearson'. The book does explain a little, though not enough to completely understand and visualize the Microcontroller working.

What i do understand is that the information across the Internet is interesting, and for us to understand this completely, we need to visualize it's working well. More information from fellow members are welcome.
 
There are java simulators online that show flow of data
being worked on. Showing the various elements, like adders,
memory, instruction decode interacting with each other.
If thats what you are looking for.

State machines govern the sequential aspect of processors,
a short study of those basic concepts helps.

Go to youtube and search "visual basic microprocessor operation", lots of
videos.

Regards, Dana.
 
danadak
I did check for the youtube videos. It seem to be similar to the ones in the books. What i needed was in depth analysis of each and every operation, and how the system evaluates each and every instruction that needs to be processed.

I'm not sure where i can find it. If Java simulators are the answer, let me know how i can find it on the internet. For me, unless i understand anything to it's depth, i don't find it interesting to learn the subject. Hence, i have been away from learning software of microprocessor/microcontroller till now.
 
Given that modern micros, some, like ARM, have > 180,000 nand equivalent gates,
others >134,000,000,000 transistors, you might find the quest simply not in your
lifespan for completion. And this of course ignores how many quarks are affected
by each instruction.

A more beneficial approach might be the macro approach, where the basic operation,
move x to M, move y to Regtemp, add thru full adder, deposit in M, move result to
wherever, might be more beneficial a pursuit.

Same goes for compilers, best to study basic operation, in general, not the # electrons that
get deposited in a specific memory cell(s).....

Depth has limitations.


Regards, Dana.
 
Because like an orchestra, a microprocessor has a conductor. Only this conductor is more like a cook or a chef, than a music conductor. A music conductor uses a precise order and timing sequence that does not vary. But a cook......has to watch and keep track....and changes the song/soup......for the right taste solution.

A microprocessor has a program counter. It also follows and executes a list of instructions......like a musical score.

But the program counter can change during the music being played. Like a cook, it can be interrupted with a delivery, or a sour taste....and need more salt. There can be thousands of recipes or songs in that list, but some are not played....some are played.

Sorta like a music conductor playing a new song without any practice. He conducts one sheet, then the next, without ever seeing the sheets before. And not knowing what sheet is coming next. And the previous sheet can decide on the next sheet being played.

It's done with an instruction list, that can change depending on the results of the previous instruction. Synthesized thought. A procedural sequence based on previous results. Elemental decision making.

The hardware supplies the program path, the data path and the logic circuits and I/O to manipulate the electrical patterns.
 
Back in the Windows XP days, a chap called John Becker made a program called PICTutor, which would graphically show the data flow inside a PIC microcontroller different building blocks, for any assembly instructions you could type. It would also have a list of exercises and sample assembly programs. It was a wonderful, wonderful program.

But then Microsoft released W7 and the program would not run anymore. John then released Assembly for PICMicro V6, which was an enhanced PICTutor which would run on W7. But this program is no longer available either.
 
Back in the Windows XP days, a chap called John Becker made a program called PICTutor, which would graphically show the data flow inside a PIC microcontroller different building blocks, for any assembly instructions you could type. It would also have a list of exercises and sample assembly programs. It was a wonderful, wonderful program.

But then Microsoft released W7 and the program would not run anymore. John then released Assembly for PICMicro V6, which was an enhanced PICTutor which would run on W7. But this program is no longer available either.
John Becker was the editor of Practical Electronics magazine for a few years, and wrote some great stuff for PIC's published in that magazine.

However, rather bizarrely he used a share ware assembler (TASM?), rather than the free MPASM one from MicroChip, and the code wasn't compatible.

I helped John out on a few things, he was a really nice guy, and I asked him why he didn't use MPASM - to be told he'd never heard of it :D He did eventually write a PC program that did conversion between the two formats.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top