Книга: Advanced PIC Microcontroller Projects in C

1.2 Microcontroller Systems

A microcontroller is a single-chip computer. Micro suggests that the device is small, and controller suggests that it is used in control applications. Another term for microcontroller is embedded controller, since most of the microcontrollers are built into (or embedded in) the devices they control.

A microprocessor differs from a microcontroller in a number of ways. The main distinction is that a microprocessor requires several other components for its operation, such as program memory and data memory, input-output devices, and an external clock circuit. A microcontroller, on the other hand, has all the support chips incorporated inside its single chip. All microcontrollers operate on a set of instructions (or the user program) stored in their memory. A microcontroller fetches the instructions from its program memory one by one, decodes these instructions, and then carries out the required operations.

Microcontrollers have traditionally been programmed using the assembly language of the target device. Although the assembly language is fast, it has several disadvantages. An assembly program consists of mnemonics, which makes learning and maintaining a program written using the assembly language difficult. Also, microcontrollers manufactured by different firms have different assembly languages, so the user must learn a new language with every new microcontroller he or she uses.

Microcontrollers can also be programmed using a high-level language, such as BASIC, PASCAL, or C. High-level languages are much easier to learn than assembly languages. They also facilitate the development of large and complex programs. In this book we shall be learning the programming of PIC microcontrollers using the popular C language known as mikroC, developed by mikroElektronika.

In theory, a single chip is sufficient to have a running microcontroller system. In practical applications, however, additional components may be required so the microcomputer can interface with its environment. With the advent of the PIC family of microcontrollers the development time of an electronic project has been reduced to several hours.

Basically, a microcomputer executes a user program which is loaded in its program memory. Under the control of this program, data is received from external devices (inputs), manipulated, and then sent to external devices (outputs). For example, in a microcontroller-based oven temperature control system the microcomputer reads the temperature using a temperature sensor and then operates a heater or a fan to keep the temperature at the required value. Figure 1.1 shows a block diagram of a simple oven temperature control system.

The system shown in Figure 1.1 is very simple. A more sophisticated system may include a keypad to set the temperature and an LCD to display it. Figure 1.2 shows a block diagram of this more sophisticated temperature control system.


Figure 1.1: Microcontroller-based oven temperature control system LCD


Figure 1.2: Temperature control system with a keypad and LCD

We can make the design even more sophisticated (see Figure 1.3) by adding an alarm that activates if the temperature goes outside the desired range. Also, the temperature readings can be sent to a PC every second for archiving and further processing. For example, a graph of the daily temperature can be plotted on the PC. As you can see, because microcontrollers are programmable the final system can be as simple or as complicated as we like.


Figure 1.3: A more sophisticated temperature controller

A microcontroller is a very powerful tool that allows a designer to create sophisticated input-output data manipulation under program control. Microcontrollers are classified by the number of bits they process. Microcontrollers with 8 bits are the most popular and are used in most microcontroller-based applications. Microcontrollers with 16 and 32 bits are much more powerful, but are usually more expensive and not required in most small-or medium-size general purpose applications that call for microcontrollers. The simplest microcontroller architecture consists of a microprocessor, memory, and input-output. The microprocessor consists of a central processing unit (CPU) and a LCD control unit (CU). The CPU is the brain of the microcontroller; this is where all the arithmetic and logic operations are performed. The CU controls the internal operations of the microprocessor and sends signals to other parts of the microcontroller to carry out the required instructions.

Memory, an important part of a microcontroller system, can be classified into two types: program memory and data memory. Program memory stores the program written by the programmer and is usually nonvolatile (i.e., data is not lost after the power is turned off). Data memory stores the temporary data used in a program and is usually volatile (i.e., data is lost after the power is turned off).

There are basically six types of memories, summarized as follows:

Оглавление книги

Оглавление статьи/книги

Генерация: 0.567. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз