You are here probably because, you want to learn microcontrollers or you already have been learning it but want to see if there is anything else you are missing or need to know. Well, I will be writing notes, tutorials on microcontrollers here and I will try to keep it as simple as possible. But remember it is a huge world where the possibilities are infinite. So sit tight and keep learning and don’t forget to share your opinions, because I can’t guarantee 100% because like you, I am learning as well.
Microcontrollers are tiny computers with some nice built in features. Think about your PC, what does it have ? A processor, some RAM(random access memory), one or more disk drives(harddisks you may call), a keyboard, a mouse, one or more monitors, may be a graphics card, may be a sound card too. Do you think I have forgot something important ? Yes, I did. Your PC has a power supply without which it’s kind of useless. And there’s the motherboard where all the accessories are connected. There are also a lot more things to mention like the BIOS chip, fans etc etc. With all these things your PC has become so powerful that it can do multitasking, can do simulations and play games. Let’s try to simplify things a bit. Here’s a rough sequence showing the workflow of your PC –
- Your first power up the PC.
- The processor starts executing code from the BIOS chip.
- This code initializes almost all of the accessories connected to your motherboard and searches for a harddisk where there is a bootloader installed.
- Say you have a 1TB harddisk where you have installed windows OS. So the BIOS finds that there is a windows bootloader installed at beginning of that harddisk.
- The BIOS now instructs the processor to execute code from that bootloader software.
- Bootloader searches for a drive where the windows is installed and it finds it in say the C:\ drive.
- At this point bootloader instructs the processor to load the windows kernel and execute it’s code.
- Now the kernel starts the windows OS and soon you see the welcome screen of windows.
- You log in and start doing your stuffs.
In this sequence, every code and associated data is first loaded in the RAM and through a more complex way the processor fetches those codes and executes. This is why the RAM is called the Primary Memory, the diskdrives are called Secondary memory . The processor is the Brain of the computer. The monitor and the sound system are the Output Devices. The keyboard and mouse are the Input Devices. You can call the accessories as Peripherals.
Well, a microcontroller is a PC with all these things in a tiny chip. Of course you don’t have power like a PC but you have a very similar setup. All in one little chip –
Let’s see what a microcontroller offers you –
- A processor (8-bit, 16-bit or 32-bit)
- A primary memory called SRAM
- A secondary memory called Flash memory
- Another nonvolatile(means your data will be saved even if there is no power) memory called EEPROM(Electrically Erasable and Programmable Read-Only Memory). Don’t get confused with the name. It’s not a read-only memory !
- You see those pins coming out of the chip ? those are I/O (input/output) pins. Those are your input / output.
- A few built-in modules like – Timers, ADC(analogue to digital converter), Analogue comparator, PWM(pulse width modulation) channels, SPI(serial peripheral interface), I2C(inter IC), USB(universal serial bus) and many more. It depends on what chip you are using.
Let’s see what happens when you power up a microcontroller –
- You power up the circuit.
- Microcontroller starts executing code from the flash memory.
Voila ! that’s all ! This time only data is stored in the primary memory ! Fetching code from flash memory happens through some internal registers(they are memories as well).
Now let’s see the features of a typical microcontroller. I am going to list the features of ATmega8 – a 8-bit microcontroller from Atmel .
- An 8-bit processor with frequency bandwidth 0~16MHz(while your PC’s processor has a bandwidth of some gigahertz).
- 1024 byte SRAM(while your PC may have some gigabytes of RAM)
- 8Kb of Flash memory(how large is your harddisk?)
- 512 byte EEPROM
- 23 I/O pins
- Timers, ADC, SPI, I2C, USART modules
So comparing to a PC , a microcontroller is nothing but think of an application where you need a processor dedicated to do or perform some tasks. Think that this task requires low power consumption and gives you little space to accommodate the circuit. Will your PC be a good solution for this problem ? Definitely NO. You need something small with similar capabilities integrated with a minimum power consumption. Here comes the microcontroller. All good things in a tiny chip !
In today’s world you will find at least one circuit consisting a microcontroller within your hands reach. You don’t think so ? Just look at your pendrive. They are cheap, easy to learn, simple enough to handle.
So what do you think ? Learning microcontrollers is fun. A lot of fun. So the choice is entirely yours.