Microcontroller
This is my first experience with Microcontrollers (µC).
Before I know about µC, I’ve already had a lot of experience about computer architecture and the story of running a software on a PC. I’ve then attended a summer training introducing Microcontrollers with a hands-on practice. Let’s get started…
What is a Microcontroller?
Microcontroller is actually a computer but a small one. It’s simply a computer on a chip. It has all the 3 main elements of any stored-program computer system. It has a processor, a storage memory and some I/O facilities.
Comparison between Microcontroller and PC
- In a PC: Processor, memory and I/O each is provided as a separate chip and are linked together via bus connections on a Mother Board while on the other hand – in a Microcontroller – these elements are all fabricated together on a single chip. This is why we call Microcontroller a simple and small computer on a chip.
- Microcontroller’s processing unit is not as powerful as a PC’s one that has a wide and complex instruction set. A PC is a general purpose machine and that’s why there should be a powerful processor compared to a Microcontroller’s one for the reason in the next point.
- Microcontoller is a special purpose computer i.e. It tends to have a single dedicated function when used inside some circuit. One should write a control program, burn it to the µC, connect the µC in the circuit and it’s all done. If you’d like to use it to do a different task, you’ll have to replace the control program with a new one.
A µC is sometimes called an embedded computer. µC actually has seven main components which are CPU, RAM, I/O, ROM, Timer, Interrupt Circuitry and Buses. This is shown below:
Where can we see µC in the real life?
Microcontrollers are used everywhere. Have you ever heard about Embedded Systems (Like your mobile phone, MP4, Router, …)?. µC is one of the most significant components used in any Embedded System.
Typical µC Example
This is an example of a µC from the popular PIC family: PIC16F877A
P16F877A Pin Diagram
In the P16F877A µC above, there are 4 I/O ports:
- PORTA: pins RA0-RA5
- PORTB: pins RB0-RB7
- PORTC: pins RC0-RC7
- PORTD: pins RD0-RD7
Note that some of the pins of each PORT are multiplexed to do different functions when needed. For example PORTA pin RA4 is multiplexed with the Timer0 module clock input to become the RA4/T0CKI pin while other pins of PORTA are multiplexed with analog inputs AN0-AN4.
There’s also – attached with each PORT – a data direction register (TRIS_) that controls the direction of data (input or output) of each pin of that port. For example having TRISA cleared (=0 which is the default) will configure all pins of PORTA as output while setting TRISA=15 will configure RA0, RA1, RA2 as input while other pins of that port are by default output.
There are a lot to say about the µC above and it’s all in its data sheet. However the information given above is enough to write our first program.
My first µC control program
Language: C
Compiler: MicroC 8.2.0.0
Design Software (Simulator): Proteus 7.5 SP3
firstProgram.c
The program is relatively simple. Its purpose is to have a seven segment blinking.
Design on Proteus
Finally, I’d like to say that there are some helpful Development Boards like EasyPIC5 provided by MikroElektronika™ which is the same company that provides MikroC the compiler I used above.
Resources:
Hope this is of benefit to you.
– Ahmed Abdullah
Leave a comment
Sticky Posts
Recent Posts
Recent Comments
Kika Córdova Costa on XOR – The Interesting… | |
Ahmed Abdullah on Creating multiple FTP accounts… | |
Helen on Creating multiple FTP accounts… | |
nikhil on XOR – The Interesting… | |
Ahmed Abdullah on A message to myself |
Post Categories
- A photo! (1)
- Discrete Mathematics (3)
- Embedded Systems (1)
- Fun (1)
- General (2)
- IEEE (5)
- Life (12)
- Logic Design (1)
- Software Develeopment (2)
- Tech (2)
- Thoughts (2)
- Uncategorized (2)
- Web Development (2)
That’s really an interesting and beneficial post 🙂
well done moro
u have to study hard
great work Moro
could you complete the tutorial series ?
really, it seem hard and intelligant work but u know i have alittle knowledge in that field with more success my bro pepsii
please compelet in explain the component of the microcontroll in detial