We are Apogeeweb Semiconductor Electronic

WELCOME TO OUR BLOG

Home arrow PCB arrow Popularization of Science - MCU

arrow left

arrow right

Popularization of Science - MCU

Author: Apogeeweb
Date: 12 Jan 2022
 152
chips

Catalog

Introduction

Ⅰ What is the MCU?

Ⅱ The History of the MCU

Ⅲ The Classification and Application of MCU

Ⅳ China MCU Technology and Well-known Manufacturers

Ⅴ  The Basic Functions of MCU

Ⅵ Learning Methods - Using MCU

Ⅶ Six Main Dimensions of MCU Products for Future Improvement

Ⅷ Programming of MCU

Ⅸ Summary of the MCU Programming Engineer

Ⅹ How to Develop MCU 

Ⅺ 5 Tips to Solve the Questions About the MCU Crystal

Ⅻ Summary of Chip Operation

FAQ

Introduction

A microcontroller (MCU) is a small computer built on a single metal-oxide-semiconductor (MOS) integrated circuit (IC) chip. A microcontroller is made up of a CPU  (processor core), memory, and programmable input/output peripherals. On chip, a small amount of RAM, as well as ferroelectric RAM, NOR flash, or OTP ROM , is commonly included. Microcontrollers  , in contrast to microprocessors  used in personal computers  or other general-purpose applications, are designed for embedded applications and are made up of a number of discrete chips. This article will delve deeper into the MCU.

Ⅰ What is the MCU?

 

Microcontroller Unit

The microcontroller unit (MCU) appropriately reduces the frequency and specifications of the CPU  and integrates peripheral interfaces such as memory, counter, USB, A/D conversion, UART, PLC, and DMA. At the same time, even the LCD driver circuit is integrated on a single chip to form a chip-level computer, which can be controlled in different combinations for different applications, such as mobile phones, PC peripherals, remote controls, automotive electronics, industrial stepping motors, machines The control of the arm, etc., can be seen in the MCU.

mcu-components

Figure 1 MCU components

Ⅱ The History of the MCU

Microcontroller Unit has a short history, but it has evolved quickly. Its generation and development are roughly synchronized with that of microprocessors  (CPUs). Since Intel Corporation of the United States first introduced 4-bit microprocessors  in 1971, its evolution can be roughly divided into five stages. The following is an overview of the development of Intel's MCU.

1971-1976  

The initial stage of MCU development

In November 1971, Intel introduced the Intel 4004, a 4-bit microprocessor with an integration level of 2000 transistors/chips and equipped with RAM, ROM, and shift registers, which served as the first MCS-4 microprocessor. The Intel 8008 8-bit microprocessor was introduced, followed by other 8-bit microprocessors  from various companies.

1976-1980  

Low-performance MCU stage

The MCS-48 series, introduced by Intel Corporation in 1976, has a monolithic structure that integrates an 8-bit CPU.  an 8-bit parallel I/O interface, an 8-bit timer/counter, RAM, and ROM on a semiconductor chip. Its addressing range is limited (no more than 4 KB), there is no serial I/O, the RAM and ROM capacity is limited, and the interrupt system is simple, but its functions can meet the needs of general industrial control and intelligent instruments and meters.

1980~1983 

 High-performance MCU stage

High-performance 8-bit microcontrollers introduced at this stage typically include serial ports, multi-level interrupt processing systems, and multiple 16-bit timers/counters. The capacity of the on-chip RAM and ROM  is increased, and the addressing range can reach 64 KB. A/D conversion interfaces are also available on individual chips. 

1983~late 1980s  

16-bit microcontroller stage.

In 1983, Intel introduced a high-performance 16-bit microcontroller MCS-96  series. The chip integration level was as high as 120,000 transistors/chips due to the use of the most recent manufacturing process.
1990s

CPUs are developing to a higher level in all directions, such as integration, function, speed, reliability, and application fields.

 

Ⅲ The Classification and Application of MCU

MCUs are classified into two types based on their memory type: those with no on-chip ROM  and those with on-chip ROM,  The chip without on-chip ROM  must be used externally with EPROM (typically 8031); the chip with on-chip ROM  is classified as on-chip EPROM (typically 87C51), MASK on-chip mask ROM  (typically 8051), on-chip Flash (typically 89C51), and other types.

MCUs are classified into two types based on their intended use: general-purpose and special-purpose. It is classified into4, 8, 16, and 32-bit MCUs based on the width of the data bus and the number of data bytes that can be processed at the same time.

mcu-product-category

Figure 2 MCU product category

 

At present, the most widely used MCU market in China is in the consumer electronics  field, followed by the industrial field and the automotive electronics  market. Consumer electronics  include home appliances, televisions, game consoles, and audio and video systems. Industrial fields include smart homes, automation, medical applications, and new energy generation and distribution. The automotive field includes automotive powertrains and safety control systems.

 

Industrial MCU

 

Industrial MCU products  are primarily used for motor control operation, data acquisition control, and other functions in motor control, instrumentation, low-voltage power distribution, power tools, industrial robots, and other application scenarios.

Electric-Vehicle-Charger

Figure 3 Electric-Vehicle-Charger

The number of MCU devices is increasing as the complexity of industrial equipment increases. Consider industrial robots: at least ten MCU products  are used in a single industrial robot.


Home Appliance MCU

 

MCU is widely used in household appliances, mainly used to realize system control, motor control, panel display control, and other functions.

The home appliance market is mainly divided into small household appliances and everyone electricity, small household appliances including kitchen appliances (microwave oven, induction cooker, soybean milk machine, etc.), household appliances (vacuum cleaner, electric fan, electric heater, etc.), personal life small household appliances (electric toothbrush, hairdryer, etc.), everyone electricity mainly for air conditioning, refrigerator, washing machine, and other white appliances.

induction-heating-cooker-app-block-diagram

Figure 4 Induction-heating-cooker-app-block-diagram

At the moment, 32-bit MCUs have become the market's mainstream due to their higher specifications and performance, as well as their constantly decreasing cost, and are widely used in automotive electronics.  industrial control/medical, and other fields; however, there are still a large number of application scenarios requiring simple control, and low-value MCUs have cost advantages, so they continue to occupy a large market.

Bit Application
4 Calculator, auto instrument, auto anti-theft device, pager, wireless phone, CD player, LCD dynamic controller, children's toys, scales, chargers, Tire gauge, thermometer, remote control, etc
8 Electrical appliances, ammeter, motor controller, electric toy machine, pager, fax machine, keyboard and USB, etc
16 Mobile phones, digital cameras and video recorders, etc
32 Smart home, IoT, motor and frequency conversion control, security monitoring, fingerprint identification, touch keys, Modem, GPS, STB, Workstation, ISDN telephone, laser printer and color fax machine, etc
64 Advanced workstation, multimedia interactive system, advanced TV game instrument, advanced terminal, etc.

According to IC Insights, the global MCU market is about 16.4 billion dollars in 2019 and could reach about 20 billion dollars by 2023.

The scale of China's MCU market was about 25.6 billion yuan in 2019, accounting for about 26% of the global market, with a compound growth rate of 9% from 2015 to 2019.

In terms of the global market, the auto circuit accounts for 33% of the global MCU market. According to IC Insights data, the automotive MCU market space will reach $8.1 billion in 2023, the overall growth rate is considerable; At the moment, 32-bit MCUs have become the market's mainstream due to their higher specifications and performance, as well as their constantly decreasing cost, and are widely used in automotive electronics.  industrial control/medical, and other fields; however, there are still a large number of application scenarios requiring simple control, and low-value MCUs have cost advantages, so they continue to occupy a large market.

mcu-market-structure

Figure 5  MCU Market Structure

From the perspective of pattern, the top five global automotive MCU market shares in 2020 were Renesas, NXP, Infineon, Texas Instruments and Microchip, accounting for 87% in total.

Ⅳ China MCU Technology and Well-known Manufacturers

MCU market is still dominated by overseas leaders, and Chinese high-quality manufacturers are gradually making breakthroughs in the segmented fields, and their share is expected to increase rapidly under the background of accelerated localization in China.

The global MCU market is expected to grow further, with the global MCU market size reaching $16.4 billion in 2019 and $20 billion in 2023.

On the demand side, improvements in automotive electrification, accelerated IoT  penetration, increased demand for intelligent frequency conversion in home appliances, rapid iteration of wearable devices, and steady growth in industrial control continue to drive the rapid growth of the MCU industry. (Using MCU as an example, the global market compound growth rate from 2020 to 2023 is 7.7 percent, and the market space is expected to be 8.1 billion dollars by 2023)

On the supply side, the MCU industry is experiencing a continuous shortage due to the epidemic in 2020. Infineon, NXP.  and ST  , as well as other overseas MCU large factories, have appeared several times to dozens of times the price, with delivery times of more than 50 weeks; persistent shortages are expected to last at least through the end of 2021 and the first quarter of 2022.

In terms of circuit barriers, the requirements of automobile circuits in the MCU downstream field are the highest, followed by industrial and home appliance circuits, and the relative requirements of consumer electronics  are slightly lower, according to MCU product environmental temperature, yield, and service life, and other parameters.

According to the industry competition pattern, Chinese MCU manufacturers have a low market share, benefit from accelerated replacement due to stock shortages in the short term, and have ample room for improvement in the long term:

The global MCU market is more concentrated, with a microchip, ST  MICROELECTRONICS, Renesas, TI, NXP  , Infineon, and other manufacturers occupying more than 80% of the market share; China's MCU market is approximately 25 billion yuan, and the total market share of domestic MCU manufacturers is less than 12%, primarily concentrated in the consumer market, which has ample room for expansion.

The shortage of goods leads to the acceleration of the pace of China's MCU manufacturers, in the automotive, industrial, and consumer circuit, the pace of China's MCU certification continues to accelerate.

 

Renesas Electronics - the world's first automotive MCU manufacturer

 

Renesas was founded in 2003 by the merger of Hitachi Semiconductor division and Mitsubishi Electric Semiconductor division. Its main business covers automotive, industrial, communications, and other fields. Renesas is the world's first automotive MCU manufacturer, accounting for 30% of the automotive MCU market in 2020.

Renesas MCU has a complete product line covering EV/HEV, powertrain, electric vehicle, vehicle dashboard, vehicle network, chassis control, ADAS, and other application fields.

Microchip technology -8 bit MCU main features, acquisition of Atmel to supplement the strength of 32 bit MCU

Microchip Technology Corporation (Microchip) was founded in 1989, Microchip technology is the world's leading supplier of single-chip and analog semiconductors. The company's main business is the microcontroller, memory products, analog interface, and mixed information products, technology licensing, and so on.

The products are mainly used in embedded control systems and IoT-related industries, including data processing, Medical Internet + (IoT), smart city, Industry 4.0, intelligent healthcare, etc. Major customers include Intel, DellLockheed Martin, HP, Boeing, etc.

 

STST -ARM architecture MCU king

 

ST was founded in 1987, its products are mainly used in automotive products, computer peripherals, communication systems, consumer products, industrial automation control systems, and other aspects. Its major customers include Apple, blackberry, Bosch, Cisco, Conti, HP, Nokia, Obata, Samsung, and Western Digital.

MCU vehicle grade products accounted for 32.13% of the company's revenue. St holds 8.5% of the current MCU market and is the leader in the segmented 32bitMCU  market.

ST has been deeply engaged in the automotive semiconductor field for many years, and the company has a complete industrial chain, its products have a very high-cost performance ratio, and occupy a dominant position in the MCU of vehicle regulation level. Its customers include Nissan, Audi, SAIC, Tesla, and many other companies.

 

NXP - the world's leading automotive MCU manufacturer

 

NXP Semiconductor was founded in 2006. It was formerly the semiconductor division of Philips. NXP's main business is MCU, MPU, and other products, which can be widely used in automotive electronics  , industrial control, smart city, smart home, and wearable products. Its MCU/MPU based on the S32 automotive platform has obvious advantages in safety and efficiency and has been adopted by mainstream OEMs around the world.

The industry's first crossover MCU was independently developed by NXP: I. MX RT series. Such products have been recognized by many Internet platforms (such as Amazon) for their high integration, cost performance, and security.

NXP's acquisition of Freescale (founded by MOTOROLA) in 2015 gives it a deeper presence in the automotive industry. In 2020, 47% of its revenue came from vehicle MCU. At present, the company accounts for 27.8% of the global automotive MCU industry, ranking second in the world. NXP  provides complete semiconductor solutions for intelligent vehicles including automotive entertainment systems, Advanced Driver Assistance Systems (ADAS).

 

Sino Wealth Electronics - China's largest home appliance MCU manufacturer

 

Sino Wealth Electronic Ltd. is an MCU integrated circuit design company, the main products include 8-bit Flash MCU, 8-bit OTP/Mask MCU, 16-bit  DSP , 4-bit OTP/Mask MCU, widely used in household appliances, automotive, industrial control, security, and other fields;

In the field of small household appliances, the company's competitors are mainly ABOV from Korea and Holtek from Taiwan. In the field of white household appliances, the company's competitors are mainly from Europe and America, including Renesas, NEC, TI, STM, and so on.

 

Ⅴ The Basic Functions of MCU

internal-function-diagram

Internal-function diagram

For most MCUs, the following functions are the most common and basic. The description methods for different MCUs may differ, but the essence is essentially the same.

1. Timer: Although there are many different types of Timers, they can be divided into two categories. The first is a Timer with a fixed time interval, which means that its timing is set by the system and cannot be controlled by the user program. The system only provides a few different types of Timers. The user program is given a fixed time interval, such as 32Hz, 16Hz, 8Hz, and so on. Because Timers of this type are relatively common in 4-bit MCUs,they can be used to implement clock, timing, and other related functions.

The other type is Programmable Timer. The timing of this type of Timer can be controlled by the user's program. The control methods include the selection of the clock source, the selection of the prescale number, and the setting of the preset number, etc. There are Most MCUs have all three at the same time, and some may have one or both of them. This kind of Timer application is very flexible, and the actual use is also ever-changing. One of the most common applications is to use it to achieve PWM  output.

Since the clock source can be freely selected, such Timers are generally combined with the Event Counter.

2. IO port: Any MCU has a certain number of IO ports. Without IO ports, the MCU will lose the channel of communication with the outside world. According to the configurable situation of the IO port, it can be divided into the following types:

Pure input or pure output : This type of IO port is determined by the MCU hardware design, and can only be input or output, and cannot be set in real-time by software.

3. Directly read and write IO port: For example, the IO port of MCS-51 belongs to this type of IO port. When the read IO port command is executed, it is an input port; when the write IO port command is executed, it is automatically an output port.

Program programming to set the direction of input and output: the input or output of this type of IO port is set by the program according to the actual needs, the application is more flexible, and can realize some bus-level applications, such as12C bus, various LCD, LED Driver control bus, etc.

When using the IO port, this point must be kept in mind: for the input port, there must be a clear level signal to ensure that it cannot be floated (this can be achieved by adding a pull-up or pull-down resistor); and for the output port, the output state level must be Considering its external connection, it should be ensured that there is no source current or sink current in Standby or static state.

External interrupts: External interrupts are a basic function of most MCUs. They are commonly used for real-time signal generation, data sampling, and state detection. Rising edge, falling edge, and level triggering are all interrupting methods. In most cases, the external interrupt is handled via the input port. If it is an IO port, the interrupt function will only be enabled when it is set as an input port; if it is set as an output port, the external interrupt function will be automatically closed (with some exceptions in ATMEL's ATiny series, where the output port can also trigger the interrupt function). The application of external interrupt is as follows:

Detection of external trigger signals: One is based on real-time requirements, such as thyristor control, detection of sudden signals, and so on, while the other is based on power savings.

Measurement of signal frequency:: To ensure that the signal is not missed, an external interrupt is the best option.

Decoding data: To reduce design costs in the field of remote control applications, it is frequently necessary to use software to decode various encoded data, such as Manchester and PWM encoding.

Button detection and system wake-up: In order for the MCU to enter the Sleep state, it must be woken up via an external interrupt. The most basic form is a button, and the level change is caused by the button's action.

4. Communication interface: The communication interface provided by MCU generally includes SPI interface, UART. I2C interface, etc., which are described as follows:

SPI interface: This type of interface is the most basic communication method provided by most MCUs. Its data transmission is controlled by a synchronous clock. The signals include SDI (serial data input), SDO (serial data output), SCLK (serial clock), and Ready signal; in some cases, there may be no Ready signal; this type of interface can work in Master mode or Slave mode, the popular saying is to see who provides the clock signal, the party providing the clock is the Master, and the opposite party It is Slaver.

UART(Universal Asynchronous Receive Transmit):It belongs to the most basic asynchronous transmission interface. Its signal lines only have two Rx and Tx lines. The basic data format is: Start Bit + Data Bit(7-bits/8-bits) + Parity Bit(Even, Odd or None) + Stop Bit(1~2Bit). The time occupied by one bit of data is called Baud Rate .

For most MCUs, the length of data bits, data check mode (odd check, even check or no check), Stop Bit length and Baud Rate can be flexibly set through program programming. Certainly. The most common way of this type of interface is to communicate with the serial port of the PC.

I2C interface: I2C  is a data transmission protocol developed by Philips. It also uses two signals to implement: SDAT (serial data input and output) and SCLK (serial clock). The biggest advantage is that multiple devices can be attached to this bus, and they can be identified and accessed through addresses; one of the biggest advantages of the I2C  bus is that it is very convenient to use software to implement through the IO port, and the data rate of its transmission is completely controlled by SCLK. To control, it can be fast or slow, unlike the UART  interface, which has strict rate requirements.

5. Watchdog: Watchdoga basic configuration of most MCUs, can only allow the program to reset it but not close it (some are set when the program is burned in, such as Microchip PIC  series MCUs), while some MCUs are It is determined by a specific method whether it is turned on or not. For example, in Samsung's KS57 series, as long as the program accesses the Watchdog  register, it is automatically turned on and cannot be turned off again. Generally speaking, the reset time of the watchdog can be set by the program. The most basic application of Watchdog  is to provide a self-recovery ability for the MCU to crash due to unexpected failure.

Ⅵ Learning Methods - Using MCU

The basic principles and functions of any MCU are similar. The only difference is the configuration and quantity of its peripheral function modules and the instruction system.

For the instruction system, although it seems to be different in form, it is only a difference in symbols, and the meanings it represents, the functions to be completed, and the addressing modes are similar.

To learn about an MCU, the first thing you need to know is its ROM space, RAM space, number of IO ports, number of timers and timing methods, peripheral function modules (Peripheral Circuit) provided, interrupt sources, operating voltage, and power consumption, etc.

After understanding these MCU Features, the next step is to compare the functions of the selected MCU with the required functions of the actual project development and clarify which resources are currently required and which are not used in this project.

For the functions that need to be used in the project but are not provided by the selected MCU, it is necessary to carefully understand the relevant information of the MCU, to use an indirect method to achieve it. For example, the developed project needs to communicate with the COM port of the PC, and If the selected MCU does not provide a UART  port, it can be implemented through external interrupts.

For the resources needed for project development, you need to carefully understand and read the Manua*, while for the unneeded function modules, you can ignore or browse. For MCU learning, the application is the key and the main purpose.

For beginners or designers who use this MCU for the first time, they may encounter a lot of ambiguous descriptions of the functions of the MCU. For this kind of problem, there are two ways to solve it, one is to write a special verification program to understand the functions described in the data; the other can be ignored for the time being. Leave it to modify and improve when debugging. The former method is suitable for projects with loose time and beginners, while the latter method is suitable for those who have some experience in single-chip development or when the project schedule is more urgent.

Don't take the time to learn the command system in particular. The instruction system is simply a logical description symbol. During programming, you can only check the relevant instructions in accordance with the logic requirements of the program. As your programming skills improve, you will become more proficient in the instruction system.

Ⅶ Six Main Dimensions of MCU Products for Future Improvement

  • Stronger computing performance: MCU towards 500Mhz main frequency, MPU increase more processor cores;
  • Additional wireless connection functions: More RF modules have been integrated.
  • Low power consumption, high energy efficiency ratio: integrated analog chip, and low power analog peripherals
  • Continued support for hardware accelerators: high integration of algorithms and tools
  • Safety: improve anti-interference ability and safety
  • Cost-effective: reduce cost

Ⅷ Programming of MCU

The programming of MCUs and PCs differ significantly. Although C-based MCU development tools are becoming more popular, assembly language remains the most concise and efficient programming language for designers who are efficient program code and like to use assembly.

Circuit-diagram-to-build-your-own-microcontroller-programmer

Circuit diagram to build your own microcontroller programmer

The basic framework for MCU programming is roughly the same, divided into the initialization part (the biggest difference between MCU programming and PC programming), the main program loop body, and the interrupt handler. as shown below:

1.Initialization: The most basic and important step in the design of all MCU programs is an initialization, which generally includes the following:

  • Mask all interrupts and set the stack pointer to In general, the initialization section does not want any interruptions to occur.
  • Clearing the system's RAM and displaying the Memory: Although it is not always necessary, it is recommended to develop good programming habits for the sake of reliability and consistency, particularly to avoid accidental errors.
  • IO port initialization: Set the input and output modes of the relevant IO port based on the project's application requirements. Set the pull-up or pull-down resistance for the input port, and the initial resistance for the output port.
  • Interrupt setup: Enable and set interrupt trigger conditions for all interrupt sources required by the project, and close unnecessary interrupts that are not used.
  • Initialization of other functional modules: For all peripheral functional modules of MCU that need to be used, corresponding Settings must be carried out according to the application requirements of the project. For example, Baud Rate, data length, verification mode and Stop Bit length should be set for communication of UART  , and clock source should be set for Programmer Timer. Frequency and Reload Data, etc.
  • Initialization of parameters: after completing the initialization of MCU hardware and resources, the following is the initialization of some variables and data used in the program. This part of initialization needs to be designed according to the specific project and the overall arrangement of the program. For some applications that use EEPROM to store the number of prefab items, it is recommended to copy the relevant data to THE RAM of MCU during initialization to improve the speed of data access and reduce the power consumption of the system (in principle, access to the external EEPROM will increase the power consumption of the power supply).

2.Main program loop body:

  • Most MCUs run continuously for a long time, so their main program bodies are basically designed in a looping manner. For applications with multiple working modes, there may be many Each loop body is converted between each other through state flags. For the main program body, the following modules are generally arranged:
  • Calculation procedures: Calculation procedures are generally time-consuming, so it is strongly opposed to processing in any interrupt, especially multiplication and division operations.
  • Processing programs with low or no real-time requirements;
  • Display transfer program: mainly for applications with external LED and LCD Driver.

3. Interrupt handler:

The interrupt program is mainly used to handle tasks and events with high real-time requirements, such as detection of external sudden signals, detection, and processing of buttons, timing counting, LED display scanning, etc.

Under normal circumstances, the interrupt program should keep the code as concise as possible. For functions that do not need to be processed in real-time, the trigger flag can be set in the interrupt, and then the main program executes the specific transaction - this is very important, especially for low-power, low-speed MCUs, is necessary to ensure timely responses to all interrupts.

4. There are various MCU processing methods for various task bodies.

For example, for low-speed, low-power MCU (Fosc=32768Hz) applications, considering that such projects are handheld devices and use ordinary LCD, the response to buttons and display response requires high real-time performance, so generally Timed interrupts are used to process button actions and data display; for high-speed MCUs, such as Fosc>1MHz applications, since the MCU has enough time to execute the main program loop body at this time, it can only be interrupted at the corresponding Various trigger flags are set in the program, and all tasks are executed in the main program body.

5. In MCU programming, special attention should be paid to:

Avoid situations where the same variable or data is accessed or set in both the interrupt and the main body. The effective prevention method is to arrange the processing of such data in a module, and decide whether to execute the relevant operation of the data by judging the trigger flag; In other bodies (mainly interrupts), only the trigger flag is set where the processing of the data is required. This ensures that data execution is predictable and unique.

Ⅸ Summary of the MCU Programming Engineer

  1. To develop a good habit of summarizing, summarizing is not only a summary of their learning, but also a review and deepening of the learning process, but also to avoid the second error.
  2. Before writing the program, we should have a solid understanding of the project so that we can start with a solid idea and a general framework. It is critical to consider the layout and what makes the most sense. To determine which module should be completed first, specific steps for the module, how to name each function, and the relationship with other modules. Take a piece of paper and scribble down significant progress.
  3. For C language modular programming, we should first divide each module, a module programming, determine a sequence, and then write the next module based on the success of the previous one. When it comes to header files, write the module's header file after you've finished writing the module.
  4. Do not ignore the fact that the program must be unreasonable to comprehend its origins and find a solution. When looking for a source, it should be pertinent; you can search for relevant data on the Internet or consult with others. For example, the primary function of another project was incorporated into this project. Some functions are named multiple times. Step by step analysis of the cause, also according to the experimental phenomenon. When defining the port, the incorrect interface was selected. When you can't solve a problem, it's sometimes good to take a break. Things can go wrong no matter how simple they seem

The problems of code utilization efficiency, anti-interference, and MCU reliability continue to plague MCU application development. 

Ⅹ How to Develop MCU 

1 How to reduce program bugs

The following are the over-arching management parameters that should be considered during system operation in order to reduce program bugs.

Physical parameters: These are primarily system input parameters that include excitation parameters, acquisition and processing operating parameters, and result parameters at the end of processing.

Resource parameters: These are primarily the resources of the system's circuits, devices, and functional units, such as memory capacity, storage unit length, and stacking depth.

These application parameters are frequently expressed as the application conditions of some single-chip microcomputers and functional units. The term "process parameter" refers to a parameter that changes in an orderly manner during the system's operation.

2 How to improve the efficiency of C language programming code

It is an inevitable trend of the development and application of MCU to use C language to design MCU. If you are programming in C, it is best to be familiar with the C compiler you are using to achieve maximum efficiency. First test the number of statement lines in the assembly language corresponding to each C language compilation, so that you can clearly know the efficiency. When programming in the future, use the statement with the highest compilation efficiency. Each C compiler will have certain differences, so the compilation efficiency will also be different. The code length and execution time of an excellent embedded system C compiler is only 5-20% longer than the same functional degree written in assembly language.

C language can be used for complex and time-critical projects, but the premise is that you are very familiar with the C language and C compiler of the MCU system and that you pay special attention to the data types and algorithms that the C compiler system can support. Although C is the most commonly used high-level language, the C language compilation system varies due to MCU manufacturer differences, particularly in the operation of some special function modules. As a result, if you don't understand these features, you'll have a lot of trouble debugging, which will result in lower execution efficiency than assembly language.

3  How to Solve the MCU Anti-Interference Problem

The most effective way to prevent interference is to remove interference sources and cut off interference paths, but this is often difficult to do, so we can only conclude that MCU's anti-interference ability is insufficient. While improving the anti-interference capability of hardware systems, software anti-interference has received increasing attention due to its flexible design, ability to save hardware resources, and high reliability.

As for the program run fly, in fact, can also use software trap and watchdog to pull the program back to reset state, so the MCU software anti-interference is the most important to deal with the reset state.

In most cases, MCU will have some sign registers that can be used to determine the reason for the reset; alternatively, you can bury some tokens in RAM yourself. Different reset causes can be determined in each program reset by judging these signs. You can also use different flags to jump directly to the corresponding program. In this manner, the program will run indefinitely, and the user will be unaware that it has been reset.

4 How to test the reliability of the MCU system

When a MCU system design is completed, there will be different test items and methods for different MCU system products, but some must be tested:

  • lTest the completeness of the software functions of the MCU
  • lPower-on and power-off test
  • lAging test
  • lTests such as ESD and EFT 

Sometimes, we can also simulate the damage that may occur in human use. For example, the contact port of the MCU system is intentionally rubbed with the human body or clothing fabric, thereby testing the antistatic ability. Use a high-power electric drill to work close to the MCU system to test the anti-electromagnetic interference ability.

To sum up, the MCU has become an important aspect of the development and application of the computer.

Most of the functions that must be realized by analog circuits or digital circuits in the past can now be realized by software methods using a single-chip microcomputer. This control technology in which software replaces hardware is also called micro-control technology, which is a revolution of traditional control technology.

In addition, in the process of development and application, we must master the skills and improve the efficiency, so as to facilitate its wider use.

Ⅺ 5 Tips to Solve the Questions About the MCU Crystal

Crystal-oscillator-for-MCU

Crystal oscillator for MCU

Common causes of the crystal can not vibrate

  • PCB wiring error;
  • Microcontroller quality issues;
  • Crystal vibration quality issues;
  • The load capacitance or matching capacitance does not match the crystal oscillator or the capacitor quality is incorrect;
  • PCB board damp, resulting in impedance mismatch and inability to vibrate;
  • The crystal oscillator circuit is too long;
  • There is a line between the feet of crystal;
  • Influence of peripheral circuit.

You are advised to rectify faults one by one as follows: 

1 Remove the possibility of circuit error so that you can compare the recommended circuit of the corresponding type of microcontroller.
2 Rule out the possibility of poor peripheral components; because peripheral components are nothing more than resistance and capacitance.
3 Rule out the possibility of using a crystal oscillator as a stop oscillator because you will not be experimenting with just one or two crystal oscillators.
4 Try changing the capacitor at both ends of the crystal; perhaps the crystal oscillator will begin to vibrate; please refer to the crystal oscillator capacitor size instructions.
5 In PC  B wiring, crystal oscillator circuit wiring should be as short as possible and as close to IC as possible, not between crystal oscillator feet.

 

Ⅻ Summary of Chip Operation

The operation of the chip is mainly the operation of the registers in the chip. The registers in the chip have their unique address mapped on the memory, which is the operation of the corresponding address. To learn the chip, first look at the sequence diagram, then understand the corresponding registers, understand how to operate, define the required port (the program can recognize), write and read the operation program.

Cross-sectional-views-of-chip-operation

Cross-sectional-views-of-chip-operation

How data is written to the chip, how it is read out, and through which port it is input or read.

When connecting a chip through a bus, the first step is to understand the protocol of the bus. The chip connected to the I2c bus is controlled by the bus.

1

One 74HC595 lattice is used for column selection, and the other two are used for color selection. The lattice is equivalent to a set of diodes.

The diode lights up only when one end is switched to a high level and the other to a low level. Just one end of the selection of different, bright different colors.

Timer working mode selection: Set timer T1 in the high four digits and timer T0 in the low four digits. Then the last two characters of each mode set the working mode. When using interrupts, note that after entering the interrupt, the reset should be reset.

2

Serial port transceiver: Baud rate is generally set in mode 2 (automatic reloading initial value) because different devices have different data processing capabilities, the baud rate is set mainly to take care of low-speed devices and for communication between each other. The interrupt flag bit should be cleared by the software. When setting the serial port interrupt, either sending or receiving can enter the interrupt function, so pay attention to setting the interrupt function. (Self-sense generally sets a function, as the upper machine or lower machine).

If you send interrupts, you have to figure out how to enter interrupts the first time, so you send them once and then you can enter interrupts. Only one byte can be sent at a time, and only after TI is set to one can the next byte be sent.

3 Pcf8591ad conversion, there are four channels of input, read PC  F8591, which channel, read is that channel input voltage, after the conversion of data stored in the chip, then read. Read to write the address of the chip, the son writes device address (0 x40 | channel number) and then reads the data.
4 Da conversion is to write the device address into the chip first, then write the sub-address (0x40) and then write the digital quantity to be converted. Device address chip information is introduced.
5 For the liquid crystal display, write data display, he will always display, do not continue to refresh, to change, only re-input.
6 For THE DS1302 clock chip, reading data is read out of the first data at the falling edge of the eighth clock when writing data, and then prepare for the next output. Pay attention to the writing of the program, but also pay attention to the position of the return value.
7 In Ds1302, the register is specified first, and then data is written to it. The registers on the chip data indicate the address. 
8 Initialization is best to write, in case you forget later. When reading or writing, the first operation is the lowest or highest bid, which can be judged according to the sequence diagram.

9

For the infrared transceiver, receiving, he is according to the length of time between the two falling edges to determine the high level or low level, write a program, first with the timer to determine the length of time, save, and then into binary (the program written to see more, very good).

10

Stepper motor: mainly used as switches, stepper motor torque decreases with the increase of speed. It is mainly used for automatic feeding of parts processing on machine tools. It can also be used in high-precision control places.

Stepper motor is an open-loop control element stepper motor that converts electric pulse signal into angular displacement or linear displacement. In the case of the overload, motor speed, stop position depends only on the pulse signal frequency and pulse number, and are not affected by load change, when the stepper driver receives a pulse signal, it is driving a stepper motor according to set the direction of a fixed Angle, known as the "step Angle", its rotation is based on the Angle of the fixed step by step. The angular displacement can be controlled by controlling the number of pulses to achieve accurate positioning. At the same time, the speed and acceleration of the motor can be controlled by controlling the pulse frequency, achieving the purpose of speed regulation.

11

Servo motor : Servo motor refers to the engine that controls the operation of mechanical components in a servo system. It is an indirect transmission device for auxiliary motors. Servo motors can control speed, position accuracy is very accurate, voltage signal can be converted into torque and speed to drive the control object. Servo motor rotor speed is controlled by the input signal, and can respond quickly, in the automatic control system, used as an executive element, and has the characteristics of mechanical and electrical time constant is small, high linearity, starting voltage, etc., can receive the electrical signal into the motor shaft angular displacement or angular velocity output. It is divided into DC and AC servo motors. Its main characteristic is that when the signal voltage is zero, there is no rotation phenomenon, and the speed decreases uniformly with the increase of torque.

12

Chinese Characters overview: To output Chinese characters on display or printer, Chinese characters are designed into a dot matrix graph according to graphic symbols, and corresponding dot matrix codes (glyphs) are obtained.

The unified encoding for the representation of Chinese characters in the computer is called the internal code (such as national code), and the internal code is unique (equivalent to the id number of the character). The encoding of Chinese characters formed to facilitate the input of Chinese characters is the input code, which belongs to the external code of Chinese characters. The input code varies with the encoding mode and is diverse. The Chinese character code formed for displaying and printing Chinese characters is the character code, and the computer finds the character code in the character library through the character code and realizes its conversion.

Machine code: According to the GB code, each Chinese character has a certain binary code, but this code will conflict with THE ASCII code when handled internally by the computer. To solve this problem, the first byte of each GB code is incremented by 1. Because ASCII code only uses 7 bits, the "1" on the first digit can be used as a symbol to identify Chinese character codes. When the computer processes the code with the first digit of "1", it will be interpreted as the information of Chinese characters, and when it processes the code with the first digit of "0", it will be interpreted as the ASCII code. After such processing, the national code (internal code) is the machine's internal code.

If put this "mouth" word graphic "." With "0" instead, you can very vividly get the "mouth" glyphs :0000H 0004H 3FFAH 2004H2004H 2004H2004H 2004H2004H 2004H2004H 2004H 3FFAH 2004H 0000H 0000H. Computer to output "mouth", find shows that character first address, according to the "mouth" machine code after calculation, to find a "mouth" glyph code, and then according to the glyph code (to) in binary character generator, in turn, scan control on the screen, which is where the "0" of the binary empty, is a place where "1" swept out of the window, Then you get the character graph of the mouth.

Chinese characters are arranged according to the order of national standard codes and stored in the memory in the form of binary files, which constitute the Chinese character font library, also known as the Chinese character font library, called the Chinese character library

13

12864 liquid crystal: Each display point corresponds to a binary number, with 1 indicating on and 0 indicating off. The RAM that stores this lattice information is called the display data memory. To display a graph or Chinese character is to write the corresponding lattice information into the corresponding storage unit.

When the horizontal address = 0FH, it will be reset to 00H, but it will not automatically add one to the vertical address. Therefore, when writing multiple data in a row, the program needs to determine whether the vertical address needs to be reset

14

GDRAM: Drawing display RAM provides 128×8 bytes of memory space. When changing the drawing RAM, the horizontal and vertical coordinate values are successively written, and then two bytes of data are written to the drawing RAM. The address counter (AC) will automatically increment the horizontal address (X address) and reset to 00H when the horizontal address is 0XFH. Vertical addresses will not be carried automatically plus 1. The drawing display must be turned off during writing to the drawing RAM,

For C, a defined variable is automatically allocated space and its address is the name of the variable. Through this name, the data can be recruited in memory, and the new data can be obtained through an operation. In assembly, the programmer needs to define the storage space and send the data to the accumulator for operation, and the programmer needs to operate every step. In C, this is done by the compiler.

FAQ

1. What is the main function of microcontroller?

Microcontroller is a compressed micro computer manufactured to control the functions of embedded systems in office machines, robots, home appliances, motor vehicles, and a number of other gadgets. A microcontroller is comprises components like - memory, peripherals and most importantly a processor.

2. What is an example of a microcontroller?

The examples of 8-bit microcontrollers are Intel 8031/8051, PIC1x, and Motorola MC68HC11 families. The 16-bit microcontroller performs greater precision and performance as compared to the 8-bit.

3. What are the elements of a microcontroller?

Therefore, the microcontroller must also satisfy the five basic elements of input, calculation, storage, output, and control. These are called five elements of microcontrollers.

4. Which is best microprocessor or microcontroller?

If you need access to large amounts of really fast memory then a microprocessor is likely your best option. A microcontroller is already embedded with memory so the memory choices are fewer than with a microprocessor. The maximum amount of FLASH memory available with most microcontrollers is usually around 2MB.

5. What is difference between BIOS and CMOS?

The BIOS is the program that starts a computer up, and the CMOS is where the BIOS stores the date, time, and system configuration details it needs to start the computer. ... CMOS is a type of memory technology, but most people use the term to refer to the chip that stores variable data for startup.

6. Is CMOS a RAM or ROM?

RAM and ROM are the products, but Complimentary Metal Oxide Semiconductor (CMOS) is the process they are built in. CMOS uses two different types of transistors to achieve a lower overall power consumption.

7. Whats an RTC battery?

The Real Time Clock (RTC) battery provides power for the internal clock/calendar and for maintaining system configuration settings. This error can occur when a machine has been left turned-off for an extended period of time (approximately one to four months), and it is the result of a depleted RTC battery.

 

 

 

 

 

 

 

 

 

 

 

 

Best Sales of diode

Photo Part Company Description Pricing (USD)
A3295KLHLT-T A3295KLHLT-T Company:Allegro MicroSystems Remark:MAGNETIC SWITCH UNIPOLAR SOT23W Price:
12000+: $0.43400
Inquiry
ACS733KLATR-65AB-T ACS733KLATR-65AB-T Company:Allegro MicroSystems Remark:AUTOMOTIVE GRADE HIGH BANDWIDTH Price:
1000+: $2.13150
Inquiry
AS6C4008A-55SIN AS6C4008A-55SIN Company:Alliance Memory, Inc. Remark:SRAM - Asynchronous Memory IC 4Mb (512K x 8) Parallel 55ns 32-SOP Price:
220+: $3.26305
Inquiry
AM29F160DB-75EF AM29F160DB-75EF Company:AMD Remark:Flash, 1MX16, 70ns, PDSO48, Price:
Call
Inquiry
AM29F800BT-70EI AM29F800BT-70EI Company:AMD Remark:Flash, 512KX16, 70ns, PDSO48, MO-142DD, TSOP-48 Price:
Call
Inquiry
10137061-00021LF Company:Amphenol ICC (FCI) Remark:CONN RCP USB3.0 TYPEC 24P SMD RA Price:
1100+: $1.14045
2200+: $1.10244
3300+: $1.06442
5500+: $1.01120
11000+: $0.98839
Inquiry

Alternative Models

Part Compare Manufacturers Category Description
Mfr.Part#:BC32740TA Compare: Current Part Manufacturers:Fairchild Category:BJTs Description: Trans GP BJT PNP 45V 0.8A 3Pin TO-92 Ammo
Mfr.Part#:BC32740BU Compare: BC32740TA VS BC32740BU Manufacturers:Fairchild Category:BJTs Description: PNP 625mW 50V 800mA Through Hole Epitaxial Silicon Transistor - TO-92
Mfr.Part#:BC327-25ZL1G Compare: BC32740TA VS BC327-25ZL1G Manufacturers:ON Semiconductor Category:BJTs Description: TO-92 PNP 45V 0.8A
Mfr.Part#:BC327-40ZL1G Compare: BC32740TA VS BC327-40ZL1G Manufacturers:ON Semiconductor Category:BJTs Description: TO-92 PNP 45V 0.8A

Ordering & Quality

Image Mfr. Part # Company Description Package PDF Qty Pricing (USD)
AD1674AD AD1674AD Company:Analog Devices Inc. Remark:IC ADC 12BIT SAR 28CDIP Package:28-CDIP (0.605", 15.37mm)
DataSheet
In Stock:23
Inquiry
Price:
1+: $57.52000
10+: $540.33000
25+: $1307.25000
Inquiry
AD9744ACPZ AD9744ACPZ Company:Analog Devices Inc. Remark:IC DAC 14BIT A-OUT 32LFCSP Package:32-VFQFN Exposed Pad, CSP
DataSheet
In Stock:1410
Inquiry
Price:
1+: $18.12000
10+: $166.56000
25+: $399.14000
100+: $1337.65000
250+: $3128.38000
Inquiry
ADSP-21161NCCA-100 ADSP-21161NCCA-100 Company:Analog Devices Inc. Remark:IC DSP CONTROLLER 32BIT 225MBGA Package:BGA
DataSheet
In Stock:On Order
Inquiry
Price:
Call
Inquiry
ADSP-BF527BBCZ-5A ADSP-BF527BBCZ-5A Company:Analog Devices Inc. Remark:IC DSP 16BIT 533MHZ 208CSBGA Package:BGA
DataSheet
In Stock:On Order
Inquiry
Price:
1+: $33.78000
10+: $311.50000
25+: $743.75000
100+: $2660.00000
Inquiry
ADSP-BF536BBCZ-3B ADSP-BF536BBCZ-3B Company:Analog Devices Inc. Remark:IC DSP CTLR 16BIT 208CSBGA Package:208-FBGA, CSPBGA
DataSheet
In Stock:280
Inquiry
Price:
1+: $20.01000
10+: $184.59000
25+: $440.73000
100+: $1576.24000
250+: $3759.13000
Inquiry
AD534LDZ AD534LDZ Company:Analog Devices Inc. Remark:IC PREC MULTIPLIER 14-CDIP Package:14-CDIP (0.300", 7.62mm)
DataSheet
In Stock:60
Inquiry
Price:
1+: $198.87000
Inquiry
AD587KNZ AD587KNZ Company:Analog Devices Inc. Remark:IC VREF SERIES 0.05% 8DIP Package:8-DIP (0.300", 7.62mm)
DataSheet
In Stock:33
Inquiry
Price:
Call
Inquiry
AD8661ARZ AD8661ARZ Company:Analog Devices Inc. Remark:IC OPAMP GP 1 CIRCUIT 8SOIC Package:8-SOIC (0.154", 3.90mm Width)
DataSheet
In Stock:813
Inquiry
Price:
1+: $2.94000
10+: $2.64200
25+: $2.49760
100+: $2.05350
250+: $1.84260
500+: $1.77600
1000+: $1.60950
Inquiry

Related Articles

pinglun 0 comment

Leave a Reply

Your email address will not be published.

 
 
   
 
code image
Rating: poor fair good very good excellent

# 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z