Essential Guide for Beginners in Microcontroller Technology

Essential Guide for Beginners in Microcontroller Technology

Essential Guide for Beginners in Microcontroller Technology

Essential Guide for Beginners in Microcontroller Technology

Introduction

On February 15, 1946, the first electronic digital computer <span>ENIAC</span> was born, marking the beginning of the computer era.

<span>ENIAC</span> was a vacuum tube computer, with a clock frequency of only 100 kHz, but it could complete 5000 additions in <span>1s</span>. Compared to modern computers, <span>ENIAC</span> had many shortcomings, but its emergence opened a new epoch in computer science and technology, having a tremendous impact on human production and lifestyle.

During the development of <span>ENIAC</span>, Hungarian mathematician John von Neumann served as an advisor to the development team and made significant contributions to the design of the scheme.

In June 1946, John von Neumann proposed the ideas of “stored-program” and “binary operation,” further constructing the classic structure of computers consisting of an arithmetic unit, control unit, memory, input devices, and output devices.

Essential Guide for Beginners in Microcontroller Technology

The development of electronic computer technology has successively experienced five eras: vacuum tube computers, transistor computers, integrated circuit computers, large-scale integrated circuit computers, and ultra-large-scale integrated circuit computers, but the structure of computers has not broken through the classic structure framework proposed by von Neumann.

1. Composition and Application Forms of Microcomputers

1. Composition of Microcomputers

In January 1971, Ted Hoff of Intel, while collaborating with a Japanese commercial communications company to develop a desktop calculator, compressed the original scheme of over a dozen chips into three integrated circuit chips.

Two of these chips are used for program and data storage, while the other chip integrates the arithmetic unit, control unit, and some registers, known as the microprocessor (i.e., Intel 4004). The microprocessor, memory, and I/O interface circuits form a microcomputer. Each part is connected via the address bus (AB), data bus (DB), and control bus (CB).

Essential Guide for Beginners in Microcontroller Technology

2. Application Forms of Microcomputers

In terms of application forms, microcomputers can be divided into three types: multi-board machines (system machines), single-board machines, and microcontrollers.

1. Multi-board Machines (System Machines)

Multi-board machines assemble microprocessors, memory, <span>I/O</span> interface circuits, and bus interfaces on a single motherboard (i.e., microcomputer motherboard), and connect keyboards, monitors, printers, soft/hard disk drives, and optical drives to other peripheral adapter cards through the system bus. Various adapter cards are plugged into the expansion slots of the motherboard and installed in the same chassis with the power supply, soft/hard disk drives, and optical drives, forming a complete microcomputer system, referred to as a system machine.

The personal computers (<span>PC</span>) widely used today are typical multi-board microcomputers. Due to their good human-computer interface, strong functionality, and rich software resources, they are usually used for office or home business processing and scientific computing, belonging to general-purpose computers, and have become the most common tools in various fields of society.

In addition, reinforcing the chassis of the system machine and designing the bottom plate as a small bottom plate structure without a <span>CPU</span>, inserting the motherboard and various measurement and control boards into the expansion slots of the bottom plate, forms an industrial <span>PC</span>. Due to its user-friendly interface and rich software resources, industrial PCs are often used as the mainframe of industrial measurement and control systems.

2. Single-board Machines

A single-board machine is constructed by assembling the <span>CPU</span> chip, memory chip, <span>I/O</span> interface chip, and simple <span>I/O</span> devices (such as a small keyboard, LED display) on a printed circuit board, and with a monitoring program (firmware in ROM), it forms a single-board microcomputer, referred to as a single-board machine. A typical product is <span>TP801</span>.

Single-board machines have simple I/O devices, limited software resources, and are inconvenient to use. Initially, they were mainly used for teaching the principles of microcomputers and simple measurement and control systems, but they are rarely used now.

3. Microcontrollers

A microcontroller integrates a microprocessor, memory, and I/O interface circuits on a single integrated circuit chip, thus forming a single-chip microcomputer, i.e., a microcontroller.

Essential Guide for Beginners in Microcontroller Technology

The original design purpose of computers was to improve the speed of data calculation and complete massive data calculations. Computers that accomplish this task are called general-purpose computers.

With the development of computer technology, people discovered that computers also have extraordinary capabilities in logical processing and industrial control. In the control field, people are more concerned about the low cost, small size, reliability of operation, and flexibility of control.

Especially in application systems such as smart instruments, smart sensors, smart home appliances, smart office equipment, automobiles, and military electronic devices, there is a demand to embed computers into these devices. Computers embedded in control systems (or devices) for embedded applications are called embedded computers, also known as dedicated computers.

Computers for embedded applications can be divided into embedded microprocessors (such as 386EX), embedded DSP processors (such as TMS320 series), embedded microcontrollers (i.e., microcontrollers, such as 80C51 series), and embedded system-on-chip (SoC).

Microcontrollers are small in size, low in price, and highly reliable, and their extraordinary embedded application forms have unique advantages in meeting embedded application needs.

Currently, microcontroller application technology has become the most commonly used technical means in electronic application system design, and learning and mastering microcontroller application technology has extremely important practical significance.

In summary, the development of microcomputer technology is trending towards two directions: one is general-purpose computers represented by system machines, dedicated to improving the computing speed of computers while balancing control functions during massive high-speed data processing; the other is dedicated computers represented by microcontrollers, dedicated to the integration of computer control functions within the chip while balancing data processing to meet the measurement and control needs of embedded objects.

2. Development Process and Current Status of Microcontrollers

2.1 Development Process of Microcontrollers

The technology of microcontrollers has developed rapidly, and the variety of products is dazzling. The entire development process of microcontroller technology can be divided into the following three main stages:

1. Formation Stage of Single-Chip Microcomputers

In 1976, Intel introduced the MCS-48 series microcontrollers. The early products of this series integrated an 8-bit CPU, 1K byte program memory (ROM), 64-byte data memory (RAM), 27 I/O lines, and 1 8-bit timer/counter on a single chip.

The main feature of this stage is that it completed the integration of CPU, memory, I/O interfaces, timers/counters, interrupt systems, clocks, etc., within a single chip, but the memory capacity was small, the addressing range was limited (not exceeding 4K), there was no serial interface, and the instruction system was not powerful.

2. Performance Improvement Stage

In 1980, Intel launched the MCS-51 series microcontrollers. This series integrated an 8-bit CPU, 4K byte program memory (ROM), 128-byte data memory (RAM), 4 8-bit parallel interfaces, 1 full-duplex serial interface, and 2 16-bit timers/counters. The addressing range is 64 K, and it integrates a strong boolean processor to complete bit processing functions. The main feature of this stage is that the structural system has been improved, performance has greatly increased, and the control-oriented characteristics have been further highlighted. Now, MCS-51 has become a recognized classic model of microcontrollers.

3. Microcontroller Stage

In 1982, Intel launched the MCS-96 series microcontrollers. This series integrated a 16-bit CPU, 8K byte program memory (ROM), 232-byte data memory (RAM), 5 8-bit parallel interfaces, 1 full-duplex serial interface, and 2 16-bit timers/counters. The maximum addressing range is 64 K. The chip also has 8 channels of 10-bit ADC, 1 PWM (D/A) output, and high-speed I/O components.

In recent years, many semiconductor manufacturers have used the 8051 core of the MCS-51 series microcontrollers, integrating various interface technologies, reliability technologies, advanced memory technologies, and process technologies into microcontrollers, producing a new generation of 80C51 series microcontrollers with powerful functions and flexible use. The main feature of this stage is that the peripheral circuits aimed at measurement and control systems are enhanced, allowing microcontrollers to be conveniently and flexibly applied in complex automatic measurement and control systems and devices. Therefore, the term “microcontroller” better reflects the essence of microcontrollers.

2.2 Current Status of Microcontroller Products

With the continuous development of microelectronics design technology and computer technology, microcontroller products and technologies are changing rapidly. The current status of microcontroller products can be summarized in two aspects.

1. The 80C51 series microcontroller products are numerous, and a mainstream position has been formed. The improvement in the computing speed of general-purpose microcomputers is mainly reflected in the increase in CPU bit count (16-bit, 32-bit, and even 64-bit), while microcontrollers pay more attention to product reliability, economy, and embedded nature. Therefore, the demand for increasing the CPU bit count of microcontrollers is not very urgent. Years of practical application have proven that the system structure of 80C51 is reasonable and the technology is mature. Therefore, many microcontroller chip manufacturers are committed to enhancing the comprehensive functions of 80C51 microcontroller products, thus forming the mainstream product status of 80C51. Recently launched products compatible with 80C51 include:

  • ATMEL’s AT89 series microcontrollers incorporating Flash memory technology;

  • Philips’s high-performance 80C51 and 80C552 series microcontrollers;

  • Winbond’s W78C51 and W77C51 series high-speed low-cost microcontrollers;

  • LG’s GMS90/97 series low-voltage high-speed microcontrollers;

  • Maxim’s DS89C420 high-speed (50MIPS) microcontroller;

  • Cygnal’s C8051F series high-speed SOC microcontrollers, etc.

It can be seen that the 80C51 has become the mainstream series of microcontrollers, so this book focuses on 80C51 to discuss the principles and interfacing methods of microcontrollers.

2. New non-80C51 structure microcontrollers are continuously being launched, providing users with a broader range of choices. While the 80C51 and its compatible products are popular, some microcontroller chip manufacturers have also introduced some non-80C51 structure products, with significant impacts including:

  • Intel’s MCS-96 series 16-bit microcontrollers;
  • Microchip’s PIC series RISC structure microcontrollers;
  • TI’s MSP430F series 16-bit low-voltage, low-power microcontrollers;
  • ATMEL’s AVR series RISC structure microcontrollers, etc.

3. Characteristics and Application Fields of Microcontrollers

3.1 Characteristics of Microcontrollers

1. High Control Performance and Reliability

Microcontrollers are designed to meet industrial control needs, so real-time control functions are particularly strong. Their CPUs can directly operate on I/O interfaces, and their bit manipulation capabilities are unmatched by other computers. Moreover, as CPU, memory, and I/O interfaces are integrated within the same chip, the connections between components are compact, and data transmission is less susceptible to interference and environmental conditions, making microcontrollers highly reliable. Recently launched microcontroller products have integrated high-speed I/O interfaces, ADC, PWM, WDT, and other components, and have made further enhancements in low voltage, low power, serial expansion buses, control network buses, and development methods (such as in-system programming ISP).

2. Small Size, Low Price, and Easy Productization

Each microcontroller chip is a complete microcomputer. For dedicated applications with large quantities, one can match and select among various microcontroller types, and also design chips specifically to ensure that chip functions correspond well with applications. In terms of packaging, some microcontroller pins have been reduced to 8 or fewer, thus minimizing the size of application system printed circuit boards, reducing connectors, and simplifying installation. Among modern electronic devices, microcontrollers have an excellent performance-to-price ratio, which is a key reason for their widespread application.

3.2 Application Fields of Microcontrollers

Due to their good control performance and flexible embedded qualities, microcontrollers have gained extremely broad applications across various fields in recent years. They can be summarized into the following aspects:

1. Smart Instruments

Microcontrollers are used in various instruments, enhancing their functionality and accuracy, making them intelligent, while also simplifying the hardware structure of the instruments, thereby facilitating upgrades. Examples include various intelligent electrical measuring instruments and smart sensors.

2. Mechatronic Products

Mechatronic products integrate mechanical technology, microelectronics technology, automation technology, and computer technology, characterized by intelligence. Microcontrollers can play a significant role in the development of mechatronic products. Typical products include robots, CNC machine tools, automatic packaging machines, bill counters, medical equipment, printers, fax machines, and copiers.

3. Real-time Industrial Control

Microcontrollers can also be used for the collection and control of various physical quantities. The collection and control of electrical parameters such as current, voltage, temperature, liquid level, and flow can be conveniently realized using microcontrollers. In such systems, using microcontrollers as system controllers allows for different intelligent algorithms based on the characteristics of the controlled objects, achieving desired control indicators, thereby improving production efficiency and product quality. Typical applications include motor speed control, temperature control, and automatic production lines.

4. Front-end Modules of Distributed Systems

In complex industrial systems, distributed measurement and control systems are often employed to complete the collection of numerous distributed parameters. In such systems, microcontrollers serve as the front-end collection modules for distributed systems. The system possesses advantages such as reliability, convenient and flexible data collection, and low cost.

5. Household Appliances

Household appliances are another important application field for microcontrollers, with a very broad outlook. Examples include air conditioners, refrigerators, washing machines, rice cookers, high-end bathing devices, and high-end toys. Additionally, in the transportation field, automobiles, trains, airplanes, and spacecraft all have extensive applications of microcontrollers, such as in automatic driving systems for cars, aerospace measurement and control systems, and black boxes.

4. Overview of Microcontroller Application System Development

4.1 Development of Microcontroller Application Systems

When designing microcontroller application systems, after completing the hardware system design, corresponding application software must be equipped. Accurate hardware design and good software functionality design are the design goals of a practical microcontroller application system. The process of achieving this goal is called the development of microcontroller application systems. Microcontrollers, as integrated circuit chips that integrate the basic components of microcomputers, do not possess development functions when compared to general-purpose microcomputers. They must rely on development machines (a special computer system) to complete the following tasks: 1. Eliminate hardware faults and software errors in the application system; 2. Debugged programs must be stored in the microcontroller’s internal or external program memory chip.

1. Representation of Instructions

Instructions are commands that make the microcontroller execute certain operations. Within the microcontroller, instructions are stored in the program memory in binary code. Binary code is the machine code (or target code) that the computer can directly execute. For ease of writing, input, and display, people usually write machine code in hexadecimal form. For example, the binary code 0000 0100B can be represented as 04H. The meaning of 04H corresponds to the instruction that adds 1 to the accumulator A. If written as INC A, it becomes much clearer; this is the symbolic representation of that instruction, known as symbolic instruction.

2. Assembly or Compilation

Symbolic instructions need to be converted into machine code that the computer can execute and stored in the program memory of the computer; this conversion is called assembly. There are three common assembly methods:

  • The first is manual assembly, where designers refer to the microcontroller instruction encoding table to translate each symbolic instruction into hexadecimal machine code, inputting it into the development machine via a small keyboard, then debugging, and writing the debugged program into the program memory chip.

  • The second is using the assembly program of the development machine for assembly.

  • The third is using the assembly program equipped in a general-purpose microcomputer for cross-assembly, and then transmitting the target code to the development machine.

Additionally, high-level languages (such as C51) can be used for designing microcontroller application programs. The high-level language source program edited in the PC is compiled and linked to form a target code file, which is then transmitted to the development machine. This method has the advantages of short cycles, easy portability, and modification, making it suitable for developing more complex systems.

4.2 Traditional Development Methods for Microcontroller Application Systems

The microcontroller development system is also known as a development machine or emulator. The purpose of emulation is to use the resources of the development machine (CPU, memory, and I/O devices, etc.) to simulate the CPU, memory, and I/O operations of the microcontroller application system (i.e., target machine) to track and observe the operation status of the target machine.

Emulation can be divided into software simulation emulation and online emulation with development machines. Software simulation emulation is cost-effective and easy to use, but it cannot perform real-time debugging and fault diagnosis of the application system hardware. Below, only the online emulation method will be introduced.

1. Development Using Standalone Emulators

Essential Guide for Beginners in Microcontroller Technology

Standalone emulators use the same type of microcontroller as the microcontroller application system in a single-board form, equipped with LED displays and simple keyboards. This development system can perform online emulation of the microcontroller application system without the support of a general microcomputer system, facilitating debugging and modification of application software on-site.

Additionally, this development system is equipped with a serial interface, allowing it to connect with a general microcomputer system. Thus, the combination software equipped in the general microcomputer system can be used for source program editing, assembly, and online emulation debugging. The debugged target program (i.e., machine code) can then be transmitted to the emulator, using the emulator for program storage.

2. Development Using Non-Standalone Emulators

This type of emulator is constructed using a general-purpose microcomputer and emulator. The emulator is connected to the general microcomputer via serial communication. This development method requires the support of a microcomputer, utilizing the combination software equipped in the microcomputer system for source program editing, assembly, and emulation debugging. Some emulator interfaces are also equipped with EPROM writing sockets, allowing the user application programs that have been debugged to be written into EPROM chips. Compared to the previous method, this development method is less convenient for modifying and debugging parameters on-site.

Essential Guide for Beginners in Microcontroller Technology

Both of the above development methods involve removing the microcontroller chip and program memory chip from the target system during development and plugging in the emulator head drawn from the development machine, effectively lending the microcontroller from the development machine to the target machine.

Once the emulation and debugging are correct, the emulator head is removed, and the microcontroller chip is reinserted, allowing the debugged program from the development machine to be stored in the <span>EPROM</span> chip and inserted into the program memory socket of the target machine, enabling the target machine to run independently.

4.3 Development of Microcontroller Development Methods

With the widespread adoption of microcontroller chip packaging forms and the rapid development of Flash memory technology, traditional concepts of microcontroller application system development will be impacted.

Using new microcontroller application system development technologies allows for the microcontroller to be installed on the printed circuit board first, and then programs can be downloaded to the target system via the PC.

For example: SST’s <span>SST89C54</span> and <span>SST89C58</span> chips have <span>20 KB</span> and <span>30 KB</span> of <span>SuperFlash</span> memory, respectively, which can perform high-speed read/write operations, enabling in-system programming (ISP) and in-application programming (IAP) functionalities.

First, the application program is edited, assembled (or compiled), and simulated on the PC, and then the target program is serially downloaded.

Microchip’s RISC structure microcontroller <span>PIC16F87X</span> has a built-in online debugger <span>ICD</span> feature, and the company also provides simple emulators and programmers with <span>ICSP</span> functionality. Since the chip has built-in detection circuit logic, no additional hardware emulator is needed.

Through a serial cable from the PC (containing a communication function module and a connection to the target board), the emulation and debugging of the target system can be completed.

Source: Uncle Wheat

Essential Guide for Beginners in Microcontroller Technology

Essential Guide for Beginners in Microcontroller Technology

Some screenshots of electronic books

Essential Guide for Beginners in Microcontroller Technology

【Complete Set of Hardware Learning Materials Collection】

Essential Guide for Beginners in Microcontroller Technology

Leave a Comment