Pages

Microcontrollers


Microcontrollers are integrated circuits which consists of microprocessor with additional units like memories, input/output units (peripherals), etc. With this way of implementation, microcontrollers provide savings in time and space, and of course money. Abbreviated way of marking the microcontrollers is MCU (Microcontroller Unit), µC, or uC. In general, microcontrollers are designed so that they can execute a lot of different tasks, which provides an opportunity for their use in various devices. The function or the task that microcontroller executes depends on the program which is written (recorded) in it. The application of the microcontrollers is wide, from the toys, cars, industry, etc.

In fact, one microcontroller can consists of different components. However, every microcontroller consists of several basic blocks, which are necessary for its normal functioning. Typical block-diagram of a microcontroller with its basic components is shown on the Picture 1.


Picture 1: Typical block-diagram of a microcontroller



Central Processing Unit

The Central Processing Unit (CPU) is the heart of the microcontroller. The CPU is connecting element between the rest of the units of the MCU and it coordinate their work. The main function of the CPU consists of three phases and these three phases are: catch, decode and execute. In other words, the program which is written in the MCU consists of programming instructions and the task of the CPU is to find the current instruction (catch), then to decode it, because every programming instruction is coded, and finally, after decoding the instruction (that means that the CPU now knows which instruction is that) CPU needs to execute the instruction. So, the executing of the program which is written in the MCU is nothing else, but executing the programming instructions which the program consists of, successively, one after another. From the other side, this unit (CPU) allows executing of the arithmetic and logical operations, reading and writing data from and into the memory, data transfer between the peripheral components, and also data transfer between the memory and the peripheral components. For the above mentioned arithmetic and logical operations, and the data transfer, is charge a separate section from the CPU, which is called Arithmetic Logic Unit (ALU).


Memory

The memory stores the data which MCU operates with. The MCU have its own data (working) and program memory. Each of the memories is divided on certain parts which are called memory locations, and each of these locations have its own address. The CPU recognizes the certain memory location by its own address. The link which connects the CPU and the memory of the MCU is called bus. Actually, the data is transmitted via the bus. From the aspect of the PIC (Programmable Inteligent Computer) microcontrollers, the data memory, also known as RAM (Random Access Memory), is a memory which is used by the program of the microcontroller during its own execution. In this memory are stored all temporary data necessary for the program execution. More recently, all manufacturers of microcontrollers have begun to add and EEPROM (Electrically Erasable Programmable Read-Only Memory) memory, as a separate part of the data memory. This memory have the ability to save data even when the power supply is off, which is not the case with the RAM memory. This way, the microcontroller can store important parameters, so that it declares its independence. The program memory is that memory in which is stored, or written (recorded) the program for the microcontroller. Today's technology allows more times to write and erase from this memory, allowing one microcontroller to be used with different versions and improvements of the previous recorded programs, or to write in it completely different (new) program. Here it's good to mention, that the memory in some microcontrollers can be used in different ways. Thus, for example, the RAM memory, including and EEPROM memory, can contain any executable program.


Input/Output Ports

In the microcontroller there is a input/output unit which allows it to communicate with the external world. It is actually the most pins or leads that are visible on the microcontroller. The pins are grouped into groups where each group is called port. The port can be input or output. The microcontroller can send and receive data through the ports. In other words, the CPU can set the pins of a port to high or low logical level, or it can read the logical level which exists on the pins of a port. The ports of the microcontroller can also be two-way or duplex, or input and output, depending on the implementation. On many microcontrollers, some of the input/output pins have a double role, or they can perform two functions.


Timer

This integral part of the microcontroller is free counter. Its value, the counter state, increases with time at certain time intervals. These time intervals are equal. Thanks to this, the microcontroller can find the time passed between two events using the values of the counter. So, this is very useful, and from the other side, necessary component (unit) of each microcontroller. Using this unit, the microcontroller can perform different time-depending instructions, measure a flow, measure a duration of some physical phenomena, and so on.

Microcontrollers can have various other units as integral parts. Usually this depends on the manufacturers and the opportunities that they want to implement into their microcontrollers. For example, other unit can be the unit for serial communication which allows serial synchronous and/or asynchronous communication between the microcontroller and some other device. Another unit can be analog/digital convertors - the unit which allows the microcontroller to recognize and operate with analog signals, or in other words, to convert these signals in binary form, so they can be understandable for the CPU and ready for further operations. Also, nowadays most often integrated units in the microcontrollers are USB and LAN units. These units allows the MCU to communicate through USB (Universal Serial Bus) and through network (LAN - Local Area Network).


Architecture of the microcontrollers

There are two types of architectures that are used for implementation of the microcontrollers, Von Neumann and Harvard. At Von Neumann architecture the data and the program memory are connected with the CPU by one bus, or the access to the data and the instructions goes through the same bus. This type of architecture is older, and here it's obviously that the memories must share the space, or the capacity for transfer of different types of data. This results in lower speed of execution of the instructions. From the other side, the Harvard architecture is advanced progress in the design of the microcontrollers. At Harvard architecture, the data and the program memory are separated and they are connected with the CPU through two different buses. This way, the flow of information is increased, and the working speed also is increased.

No comments:

Post a Comment