1. What are the advantages and disadvantages of C language and assembly language when developing microcontrollers?
Answer : Assembly language is a symbolic language that uses text mnemonics to represent machine instructions. It is the language closest to machine code. Its main advantages are that it takes up less resources and has high program execution efficiency. However, different CPUs may have different assembly languages, so it is not easy to port.
C language is a structured high-level language. Its advantages are good readability and easy porting, and it is a widely used computer language. Its disadvantages are that it takes up more resources and its execution efficiency is not as high as assembly language.
For the 8-bit MCU with RISC architecture that is currently widely used , its internal ROM, RAM, STACK and other resources are limited. If it is written in C language, a C language instruction will become many machine codes after compilation, which may easily cause problems such as insufficient ROM space and stack overflow. In addition, some microcontroller manufacturers may not be able to provide C compilers. In assembly language, one instruction corresponds to one machine code, and it is very clear what action is performed at each step. In addition, the program size and stack call status are easy to control, and debugging is also more convenient. Therefore, in the development of microcontrollers, we still recommend the use of assembly language.
If you are interested in the C language for microcontrollers , HOLTEK's microcontrollers provide a C compiler, which can be downloaded and used for free from HOLTEK's website (www.holtek.com.cn).
2. C or assembly language can be used for microcontrollers, can C++?
Answer : In microcontroller development, assembly and C are mainly used, and C++ is not used.
3. Is it necessary to know C to develop single-chip microcomputers ?
Answer : Assembly language is a symbolic language that uses text mnemonics to represent machine instructions. It is the language closest to machine code. Its main advantages are that it takes up less resources and has high program execution efficiency. However, different CPUs may have different assembly languages, so it is not easy to port.
For the 8-bit MCU with RISC architecture that is currently widely used , its internal ROM, RAM, STACK and other resources are limited. If it is written in C language, a C language instruction will become many machine codes after compilation, which may easily cause problems such as insufficient ROM space and stack overflow. In addition, some microcontroller manufacturers may not be able to provide C compilers. In assembly language, one instruction corresponds to one machine code, and it is clear what action is performed at each step. In addition, the program size and stack call status are easy to control, and debugging is also more convenient. Therefore, in the development of microcontrollers with fewer resources, we still recommend the use of assembly language.
C language is a compiled programming language that takes into account the characteristics of multiple high-level languages and has the functions of assembly language. C language has rich library functions, fast computing speed, high compilation efficiency, good portability, and can directly control system hardware. C language is a structured programming language that supports the top-down structured programming technology widely used in current programming. In addition, C language programs have a complete module program structure, which provides a strong guarantee for the use of modular programming methods in software development. Therefore, using C language for programming has become a mainstream in software development. Using C language to write target system software will greatly shorten the development cycle, significantly increase the readability of the software, and facilitate improvement and expansion, thereby developing a larger system with more complete performance.
In summary, using C language for MCU programming is an inevitable trend in MCU development and application. Therefore, as a MCU developer who has comprehensive technology and is involved in large-scale software system development, it is best to master basic C language programming.
4. When developing a complex project with a short development time, is it better to use C or assembly?
A : For complex projects with tight development time, you can use C language, but the prerequisite is that you are very familiar with the C language and C compiler of the MCU system, and pay special attention to the data types and algorithms that the C compiler system can support. Although C language is the most common high-level language, different MCU manufacturers have different C language compiler systems, especially in the operation of some special function modules. If you don't understand these features, it will be troublesome to debug, and in the end it may not be as fast as using assembly.
5. In teaching, I need to use 8088 and 196 chip microcomputer teaching materials. Where can I find books or materials on this subject?
Answer : Regarding the textbooks on this subject, a commonly used one in universities is " IBM-PC Assembly Language Programming" published by Tsinghua University Press, which can be found on the Internet and in bookstores. In addition, many other textbooks can be searched on the Internet, such as: "Microcomputer Principles and Assembly Language Tutorial" (edited by Yang Yanshuang, Zhang Xiaodong, etc.) and "16/32-bit Microcomputer Principles, Assembly Language and Interface Technology" (author: Zhong Xiaojie and Chen Tao, published by Machinery Industry Press), etc. You can find them in larger science and technology bookstores or order them directly from the Internet.
6.Should beginners learn C or assembly first?
A : For MCU beginners, they should start with assembly language, because assembly language is the language closest to machine code, which can deepen the beginners' understanding of each functional module of MCU and lay a solid foundation.
7. I am a third-year student of electronic science and technology at Wuhan University. I have learned electronic circuits, digital logic, assembly and interface, and C language, but I always feel confused and feel like I don't know anything. What should I do? Answer: The university process is a theoretical process, and there are relatively few opportunities for practice, which often leads to a disconnect between theory and practice. This is a common problem in the domestic university education system, but students must not aim too high. Generally, you will start to get in touch with some professional courses from the third year of college. Electronic-related majors will offer related single-chip microcomputer application courses and simple experimental projects. You should fully grasp the opportunities of experimental classes and practice more on the actual machine operation. You can usually read more related electronic technology magazine websites to see other people's development experience, hardware design solutions and other people's software design experience. If possible, you can also participate in some electronic design competitions. Taking this opportunity, 2-3 people will work together to make a complete system, which will be more helpful. When you reach the fourth-year graduation design stage, you can also choose related topics to do some actual cases to gain experience. There is a process of accumulating experience in everything you do, step by step. 8. As a student, how can I learn single-chip microcomputers well? Answer: The most important thing to learn MCU is practice, and to gain experience in practice. For students in school, there are indeed fewer opportunities for practice, but if there is a chance, you can choose related topics for graduation internship, so that you can get in touch with actual projects. And if the principle of MCU is a main course, I believe the school will arrange more opportunities for practice. If you have the ability, you can find some related part-time jobs, which will be more helpful. Moreover, the development and application of MCU requires the combination of software and hardware, so you can't just be satisfied with how perfect the programming skills are. You should also pay attention to the accumulation of hardware knowledge, go to electronic forum websites more often, and buy some related magazines. If possible, you can go to the electronics market to buy some small parts and build a small system to make it work. HOTLEK's MCU is an 8-bit MCU with RISC structure, which can be widely used in household appliances, security systems, handheld games, etc. Generally speaking, it can be divided into I/O type MCU, LCD type MCU, A/D type MCU, A/D with LCD type MCU, etc. The Chinese information of these MCUs are all publicly available on the HOLTEK website www.holtek.com.cn. Download address of user manuals of various HOLTEK MCUs: http://www.holtek.com.cn/referanc/htk_book.htm Download address of HOLTEK MCU software/hardware application examples: http://www.holtek.com.cn/tech/appnote/appnote.htm Download address of HOLTEK MCU support tools: http://www.holtek.com.cn/tech/tool/tool.htm 9. How can one become a master of MCUs? Answer: To become a master of MCUs, one should practice more and always pay attention to the development trend of MCUs; often visit some related websites, where one can find a lot of useful information. 10. Are women suitable for the industry of MCU software programming? Answer: It depends on one's own interests and one's own patience for software programming. Both men and women are suitable for this industry. 11. Where can I download Holtek's data sheet? A: If you are interested in Holtek's IC, you can download the corresponding data sheet on the website http://www.holtek.com.cn/products/index.htm. 12. How long can the 8-bit machine last! A: At present, the main MCU products are still in the 8-bit field, mainly used in six major markets such as automotive applications, consumer electronics, computers and PC peripherals, telecommunications and communications, office automation, and industrial control. Among them, the automotive market is mostly in Europe and the United States, while the Asia-Pacific region is dominated by consumer electronics, and the mainstream products are large quantities and low unit prices. At present, there is still a considerable price difference between 16-bit MCUs and 8-bit products, and new application fields are still being developed. The industry predicts that at least before 2005, 8-bit MCUs will still be the mainstream of MCU products.
13. Is learning ARM and embedded systems more promising than learning other general single-chip microcomputers? What relevant knowledge should a beginner have? Answer: Generally, there is a difference in the level of embedded systems between 8-bit single-chip microcomputers and ARM. ARM is suitable for advanced products with relatively complex systems, such as PDAs, mobile phones, etc. 8-bit single-chip microcomputers are suitable for general industrial control, consumer home appliances, etc. due to their simple architecture and relatively few hardware resources. For a beginner in software programming for single-chip microcomputers, HOLTEK series or 8051 and other 8-bit single-chip microcomputers should be used as introductory exercises. Beginners should have relevant knowledge of software programming. The general software programming of single-chip microcomputers is mainly based on assembly language. Each company has its own syntax, but most of them are based on the RISC MCU architecture, where RISC (Reduced Instruction Set Computer) represents all the instructions of the MCU. They are all composed of some simple instructions. Simple instructions mean that the circuit of the MCU can be optimized as much as possible, thereby increasing the execution rate. In addition, beginners should have application knowledge of the I/O interface of the microcontroller, which depends on the use of peripheral application circuits and various components, and should be combined with the electronics and circuits they have learned. 14. What are the 80 series 8-bit microcontrollers that meet the 44PIN? Answer: The 80 series 8-bit microcontrollers that meet the 44PIN are Z8674312FSC, Z86E2112FSC, and Z86E2116FSC. 15. Please introduce the test method of MCU. Answer: There are different test methods for each different stage of MCU from production to packaging and shipment, among which there are mainly two types: intermediate test and final test. The so-called intermediate test is the test of WAFER, which will include product function verification and AC and DC tests. There are many projects. Taking HOLTEK products as an example, the most important ones are as follows: l Continuity test: Check whether the protection diode connected to each I/OPIN is functioning properly. l Functional test: inject the test data (TEST PATTERN) provided by the product designer into the IC to check whether the result is the same as the state during SIMULATION. l STANDBY current test: measure whether the leakage current of the IC meets the minimum specification when it is in HALT mode, that is, when each contact (PAD) remains unchanged in state 1, state 0 or state Z. l Power consumption test: static power consumption and dynamic power consumption of the entire IC. l Input voltage test: measure the input voltage response characteristics of each input pin. l Output voltage test: measure the output voltage level of each output pin. l Related frequency characteristics (AC) test, also through external injection of a certain frequency, from the I/O port to see whether the output matches it. l In order to ensure the long-term and stable quality of IC production, product reliability tests will also be performed. These tests include ESD test, LATCH UP test, temperature cycle test, high temperature storage test, humidity storage test, etc. The final test is the test after the product is packaged, that is, PACKAGE test. That is, all products that have passed the intermediate test are tested after packaging. The method is mainly automatic testing by the machine, but the test items are still the same as WAFER TEST. The purpose of PACKAGE TEST is to determine whether the IC is damaged during the packaging process. 16. Can a single chip be used to detect the charging and discharging time of a mobile phone battery and the changes in voltage and current during charging and discharging, and use an I/O port to display the test results on a computer? Answer: Most of the various types of smart chargers on the market currently use MCU to control the charging current and voltage. As for displaying on a computer, it seems not practical, and it may only be used in some special battery testing instruments; for ordinary mobile phone users, who would need a computer to display when charging? To achieve the connection between the single-chip microcomputer and the computer, the simplest way is to use serial communication, but an RS-232 chip needs to be added. 17. What should be done in ARM programming? Answer: Taking the concept of embedded systems as an example, general embedded processors can be divided into three categories: embedded microprocessors, embedded microcontrollers, and embedded DSPs (Digital Signal Processors). Embedded microprocessors are CPUs corresponding to the microprocessors of general-purpose computers. In applications, microprocessors are usually assembled on specially designed circuit boards, and only embedded-related functions are retained on the motherboard, which can meet the requirements of small size and low power consumption of embedded systems. Current embedded processors mainly include: PowerPC, Motorola 68000, ARM series, etc. Embedded microcontrollers are also called single-chip microcomputers, which encapsulate CPU, memory (a small amount of RAM, ROM or both) and other interface I/O in the same integrated circuit. Common ones include HOLTEK MCU series, Microchip MCU series and 8051, etc. Embedded DSP is specially used to process discrete time signals very quickly to improve compilation efficiency and execution speed. In the fields of digital filtering, FFT (Fast Fourier Transform), spectrum analysis, image processing analysis, etc., DSP is entering the embedded market in large quantities. 18. When the MCU is in radio frequency control, the clock (crystal oscillator) and data line of the MCU will radiate the base frequency or the multiple of the base frequency, which will be amplified by the low noise amplifier LNA and enter the mixing frequency, resulting in in-band Spur, which cannot be filtered out. In addition to using layout and selecting low-radiation MCU to reduce some, are there any other methods? A: There are many things to pay attention to when designing PCBs for high-frequency circuits, especially for GHz-level high-frequency circuits. It is even more important to pay attention to the impact of the length of each electronic component pad and printed pattern on the circuit characteristics. In recent years, there seems to be an increasing trend of high-frequency circuits and digital circuits sharing the same PCB to form so-called mixed circuit systems. Such designs often cause the high-frequency circuit to become unstable when the digital circuit is operating. One of the reasons is that the noise generated by the digital circuit affects the normal operation of the high-frequency circuit. In order to avoid the above problems, in addition to trying to split the two circuit blocks, it is the fundamental method to fully review the design concept before designing the PCB. Basically, the following three principles must be mastered when designing PCBs for high-frequency circuits: l High quality. l Do not take shortcuts. l Do not rush. The following are some suggestions for designing high-frequency PCBs: (1) The length of the printed pattern will affect the circuit characteristics. In particular, for transmission lines of high-speed digital circuits with transmission speeds of GHz, strip lines are usually used, and the transmission delay time is corrected by adjusting the wiring length. In fact, this also means that the location of the electronic components has an absolute impact on the circuit characteristics. (2) Ground is better. The ground layer is set on the entire copper foil surface, and the better ground connected to the via is a common feature of high-frequency circuit boards and high-speed digital circuit boards. In addition, high-frequency circuit boards are most taboo to use narrow printing patterns to depict ground. (2) The ground terminal of the electronic component is connected to the ground of the circuit board with the shortest length. The specific method is to set a via near the ground terminal pad of the electronic component so that the electronic component can be connected to the ground of the circuit board with the shortest length. (3) The signal line is designed to be short. The wiring length cannot be increased arbitrarily, and the wiring length should be shortened as much as possible. (4) Reduce the connection between circuits. In particular, it is very important to divide the circuit between the filter and amplifier input and output, which is equivalent to the cross talk countermeasure of the audio circuit. (5) MCU loop layout considerations: the oscillation circuit can only be close to the IC oscillation pin; the oscillation circuit is kept at a sufficient distance from VDD & VSS; when the oscillation frequency is greater than 1MHz, it is not necessary to add osc1 & osc2 capacitors; the power supply and ground should be at the shortest position and the lines of equal width and equal distance should be pulled as much as possible, and ceramic capacitors such as 104/103/102 should be added at the node position. 19.What precautions should be taken when developing a system for the Intel series 96 single-chip 80c196KB? Answer: The software of a real-time system consists of a real-time operating system plus an application program. The interface between the application program and the operating system is implemented through system calls. The MCU using the 80C196KB operating system can only use the internal RAM as the TCB and all system memories (including various control tables) as well as the work and data units of each task. Therefore, it is important to pay attention to the following points: (1) Each task is allocated its own stack area, which serves as both the work unit of the task and the protection unit of the task control block. (2) The system's task control block only stores the stack pointer of each task, and the status of the task is stored in the task stack. When a task exits execution, its status is pushed into the stack through an interrupt, and then its stack pointer is saved in the system's TCB; then the stack pointer SP image value of the ready task with the highest priority is taken out and sent to the SP; finally, the interrupt return instruction is executed to execute the new task. (3) The data and work units of each task should be implemented with stacks as much as possible, so that each task can use the same subroutine. Using stacking to implement parameter passing and as a working unit instead of using RAM with absolute addresses can realize reentrant subroutines. This subroutine can be called by each task and can also be called recursively. 20. When sampling voltage on the demo board, it is unstable and the sampling results fluctuate. How to eliminate it? Answer: Generally speaking, simulators work in a stable voltage environment (usually 5V). If you use the simulator's A/D, pay attention to whether its A/D reference voltage is given by the simulator itself or needs to be provided externally. A/D conversion requires a continuous clock cycle, so the single-step debugging method cannot be used during simulation, otherwise the A/D sampling value will be inaccurate. As for the instability of A/D sampling, a capacitor can be added to the A/D input port to play a filtering role; the median filtering method is used in software processing.
21. How to design an electronic anti-vibration system in a car DVD system? Answer: In a car DVD system, it is best to choose a high-end DVD player, because high-end DVD players all use an electronic anti-vibration system (ADVANCEDESP). When the reading in the memory buffer is reduced, the advanced electronic anti-vibration design will use a dual-speed reading system to make the reading rate twice as fast as the normal speed to reduce noise. Even if there is continuous vibration, it can still avoid the jump line. Now let's talk about what electronic anti-vibration is. Simply put: electronic anti-vibration is a signal storage-release process. First, the CD must read the signal in advance, that is, we see the acceleration of the machine, and then store the signal in RAM. What we hear when we turn on the anti-vibration is the sound passing through the RAM. This is its process. When there is no anti-vibration, it is because the signal is read 1:1, so when it is impacted, there will be skipping. When the anti-vibration is turned on, after the machine is impacted, the sound released by the RAM makes the music play continuously, and at the same time, the optical head quickly resets and searches, and when the signal is retrieved, it is immediately supplemented, so there will be no skipping. This is roughly the situation. However, this method still does not meet the requirements of users. Since the time brought by this method is short, usually only 3 seconds, the chance of skipping is still quite high. If the RAM is increased, the cost will increase because RAM is expensive, especially the good quality one. 22. In the electronic anti-vibration technology, what ICs or devices are available? Answer: In the electronic anti-vibration technology, one of the most important technologies is RAM technology. However, because of its cost, the anti-vibration time has not been increased. In other words, RAM itself has a limit. The larger the RAM capacity, the higher the cost. Many manufacturers have carried out research and development on how to get the maximum memory time within the limit of RAM. 23. How to reduce program bugs through programming? Answer: Here are some suggestions, because the actual operating parameters in the system are all within a range. The out-of-range management parameters to be considered in the system operation are: l Physical parameters. These parameters are mainly the input parameters of the system, which include excitation parameters, operating parameters in the acquisition process, and result parameters at the end of the process. Reasonably set these boundaries and treat the parameters that exceed the boundaries as abnormal excitation or abnormal response for error processing. l Resource parameters. These parameters are mainly the resources of the circuits, devices, and functional units in the system, such as memory capacity, storage unit length, and stack depth. In program design, resource parameters are not allowed to be used beyond the range. l Application parameters. These application parameters are often expressed as the application conditions of some single-chip microcomputers and functional units. For example, the application parameter limits such as the number of erase and write times of E2PROM and the data storage time. l Process parameters. Refers to the parameters that change in an orderly manner during the operation of the system. For a programmer, it is necessary to develop a good habit to replace the corresponding list of text parameters you like in order at the beginning of the program, and then use the text parameters you define to write the program. In this way, when modifying and maintaining the program, you only need to make changes at the beginning of the program, and you don’t need to modify the program segment, which is easier and will not make mistakes. 24. Some people believe that single-chip microcomputers will be replaced by embedded systems with ARM and other series structures. How long will the life of single-chip microcomputers last? Answer: Because of the differences in functional structure and unit price between 8-bit single-chip microcomputers and embedded system ARM, there are great differences in the application level. ARM is suitable for advanced products with greater system complexity, such as PDAs, mobile phones and other applications. 8-bit MCUs are suitable for general industrial control, consumer home appliances, etc. due to their simple architecture and relatively few hardware resources. To evaluate whether MCUs will be replaced by ARM in the near future, two factors should be observed: l Chip cost Because ARM has a higher operating frequency and a larger circuit, the required chip manufacturing process requires more than 0.25U, which is more expensive. 8-bit MCUs have a relatively low operating frequency and a smaller circuit, and the required chip manufacturing process is only 0.5U, which is less expensive. l Functional positioning ARM has stronger functions than MCUs, but the two have different positioning. Just like at this stage, no one will use ARM to make a simple industrial timer switch. Of course, it would be fine if the unit price of the two was the same, but the reality is that there is a big price difference. As for the future, because the cost of chip manufacturing will continue to decline, the impact of the above cost difference will become less and less! But I estimate that in the next five years, MCUs will still have a price advantage and can still survive! But will ARM streamline its architecture, reduce costs, and grab the low-end market? I think it is unlikely, ARM should develop upward. Similarly, MCUs can only develop upward, such as 16-bit, high-function, etc. The reason is that the chip manufacturing process is advancing too fast. This forces chip design to develop towards high integration. 25. When programming in C for a single-chip microcomputer, how can the generated code be as efficient as assembly? Answer: If you use C language to program, it is unlikely that the generated code will have the same efficiency as assembly. C language commands must be compiled by a compiler to be recognized and executed by the hardware. Compilers are divided into front-end, middle-end, and back-end. The front-end deals with programs written in various computer languages, and the back-end is connected to the basic instruction set of the processor. So if you use C programming, to achieve the highest efficiency, it is best to understand the C compiler used. First, test the number of assembly language statements corresponding to each C language compilation, so that you can clearly know the efficiency. In the future, when programming, use the statements with the highest compilation efficiency, so that you can ensure that when programming in C for a single-chip microcomputer, the compilation efficiency of different C programs with the same function is the highest. However, there are certain differences between different C compilers. The code length and execution time of an excellent embedded system C compiler are only 5-20% longer than the same function written in assembly language, so the compilation efficiency of C compilers from different manufacturers will also be different. 26. Which type of microcontroller is closer to an ARM microcontroller? Answer: Strictly speaking, ARM is not a microcontroller, but an embedded real-time operating system. ARM (Advanced RISC Machines) is a well-known company in the microprocessor industry, which has designed a large number of high-performance, low-cost, low-energy RISC processors, related technologies and software. ARM licenses its technology to many well-known semiconductor, software and OEM manufacturers in the world, and each manufacturer gets a unique set of ARM-related technologies and services. Therefore, big companies in the market such as Intel, IBM, LG Semiconductor, NEC, SONY, Philips and National Semiconductor all have ARM series. Now there is no question of which type of microcontroller is closer to an ARM microcontroller. Moreover, after purchasing the core, manufacturers will add different external function modules according to the different application directions of their own chips, so the functions provided by chips with the same core are different. 27. Will it be difficult to switch from 51 to ARM? Answer: From 51 to ARM, the principles of programming are actually the same, but it should be noted that ARM is a RISC architecture. There are many open source programs for ARM applications. If you want to improve yourself, you should look at other people's programs. Linux, uc/os-II, etc. are all very good source codes. 28. I have studied the MCS51 microcontroller textbook and am very interested, but I lack practical experience, I don't have any props to practice, and my funds are limited. What should I do? Answer: When there are no conditions for practice, if you are really interested, you can download some simulation software with software simulation function to do some programming. Some of the better 51 simulation software should have this function. HOLTEK's simulation software HT-IDE3000 also has the corresponding function. At the same time, it also has LCD software simulation and peripheral circuit software simulation. If you are interested, you can also download it for free: http://www.holtek.com.cn/tech/tool/ide.htm. At the same time, you can go to some electronic markets to buy some simple devices to practice building circuits yourself to strengthen your hardware knowledge. 29.If you already have an algorithm implemented in C for a certain MCU, keep the framework unchanged, and use assembly to optimize the core part, are there some common principles? Answer: Everyone has his own programming style and habits. If you want to use someone else's program and modify it, if his program is not well modularized, it is recommended not to do so, otherwise you may get twice the result with half the effort instead of twice the effort. It is of course possible to refer to other people's programs, but the first thing is to read and understand the essence of the algorithm of other people's programs, rather than patching it on its basis. As for algorithm optimization, you can buy some data structure books with more detailed instructions. 30. If you are going to estimate the MIPS of an algorithm, what is a good way? Answer: The running time of an algorithm refers to the time it takes for an algorithm to operate on a computer. It is roughly equal to the time required for the computer to perform simple operations (such as assignment operations, comparison operations, etc.) multiplied by the number of simple operations in the algorithm. The number of simple operations contained in an algorithm is usually called the time complexity of the algorithm. It is a relative measure of the running time of an algorithm, generally given in the form of an order of magnitude. There are usually two ways to measure the execution time of a program: l One is the post-analysis method. Because many computers have internal timing functions, programs with different algorithms can be distinguished by one or more sets of the same statistical data. However, this method has two drawbacks: First, the program compiled based on the algorithm must be run first; second, the statistical value of the time obtained depends on environmental factors such as the computer's hardware and software, which sometimes easily conceals the quality of the algorithm itself. Therefore, people often use another method of pre-analysis and estimation. l One is the pre-analysis and estimation method. The time consumed by a program when running on a computer depends on the following factors: (1) What strategy is used for the algorithm; (2) The scale of the problem. For example, whether to find prime numbers within 100 or within 1000; (3) The language in which the program is written. For the same algorithm, the higher the level of the implementation language, the lower the execution efficiency; (4) The quality of the machine code generated by the compiled program. This is related to the compiler; (5) The speed at which the machine executes instructions. Obviously, the same algorithm will have different efficiencies when implemented in different languages, compiled with different compilers, or run on different computers. This shows that it is inappropriate to use absolute time units to measure the efficiency of an algorithm. Leaving aside these factors related to computer hardware and software, it can be considered that the size of the "running workload" of a specific algorithm depends only on the size of the problem (usually expressed as an integer n), or in other words, it is a function of the size of the problem. An algorithm is composed of control structures (sequence, branch, and loop) and primitive operations (referring to operations of inherent data types), and the algorithm time depends on the combined effect of the two. In order to facilitate the comparison of different algorithms for the same problem, the usual practice is to select a primitive operation from the algorithm that is a basic operation for the problem (or algorithm type) being studied, and use the number of times the basic operation is repeated as the algorithm time measurement. The MIPS of an algorithm is a special subject, and you can refer to relevant data structure books.
31. What is the idea and design process of remote control encoding and decoding? Answer: Generally speaking, a complete remote control code is divided into four parts: header code, address code, data code and check code. The header code varies according to different manufacturers, and the address code and data code are composed of logic "1" and logic "0". The purpose of encoding design is to send different code values according to the encoding rules. Our most common code types are SONY, Panasonic, NEC and other manufacturer models. Remote control encoding chips are most commonly used in remote controls such as air conditioners, DVDs, garage doors, etc. The design of the encoding program can be divided into three parts. The first part is to understand the characteristics of the code type. The header code and address code (also called client code) of the remote control code are fixed, and the data code and check code change according to different key values. The second part is to calculate the code sending time. Most remote control codes are composed of logic "1" and logic "0", that is, a series of square waves with fixed duty cycle and fixed period. Usually the period of these square waves is milliseconds or even microseconds, and the time calculation needs to be relatively accurate. Therefore, when choosing a code-sending microcontroller model, we must consider whether the microcontroller's running speed is fast enough and whether the program running time is sufficient. The third part is the writing of the program. After selecting the microcontroller model, start designing the program flow. Generally speaking, we can use the I/O port as the output port for code transmission. The code transmission program generally consists of several subroutines, the header code subroutine, the logic 1 subroutine, the logic 0 subroutine, and the check code algorithm subroutine. Once we get the command to send the code, we first call the header code subroutine, then call the logic 1 subroutine or the logic 0 subroutine according to the customer code and key value, and finally call the check code algorithm subroutine to output the check code. HOLTEK's HT48CA0/HT48RA0, HT48CA3/HT48RA3 and HT48CA6 are microcontrollers designed for remote controllers. They have a dedicated infrared output port and can meet most of the code transmission requirements. Designing a decoding program can also be divided into three parts. The first part is to understand the characteristics of the encoding waveform. Start by analyzing the high and low pulse widths of the encoding to understand the waveform duty cycle and period of logic "1" and logic "0". Understand the characteristics of the header code. The second part determines the receiving method. Generally, we can use the I/O port query method or the INT port interrupt response method to receive the code. The difference between the two is that the I/O port query method consumes more of the microcontroller's running time resources and needs to continuously detect the level changes of I/O to avoid missing the valid code value; while the INT port interrupt reception method saves resources. When there is an external level change, the microcontroller needs to process it and does not need to detect it all the time. However, the INT port interrupt reception method cannot distinguish the waveform characteristics of different duty cycles in the same cycle. When the logic "1" and logic "0" carried by the code have this characteristic, it cannot be distinguished by the INT port interrupt reception method, because the INT interrupt is only triggered at the rising edge or falling edge. The third part stores the received code value and analyzes it. According to the width of the high and low levels (timer or delay), the code value can be obtained, which is what we call decoding. Generally, when we receive 3 identical complete code values in succession, we confirm that the code has been sent and received successfully. When the decoding is finished, we can determine which button was pressed based on the code value, and then execute the corresponding button function. HOLTEK's HT48 and HT49 (with LCD) series microcontrollers can meet most decoding tasks. 32. In the process of learning microcontrollers, how to understand the concepts of pre-scaling, 12-clock mode (6-clock model) and so on? Answer: The English word for prescaler is prescaler. It divides the input frequency signal and then outputs it. HOLTEK has a most basic 8-bit I/O type microcontroller HT48R05A-1. We will take this microcontroller as an example. HT48R05A-1 has an 8-bit up-counting timer Counter. The system clock Fsys (4MHz) enters the 8-stage prescaler for frequency division, and then enters the timer counter Counter for counting. According to the software settings, the prescaler can divide Fsys by 2n times (n=1~8). For example, if the software is set to divide the pre-divider by 2, the frequency output by the pre-divider is Fsys/2=2MHz, and this 2MHz signal enters the timing counter Counter. If you need detailed information about the HT48R05A-1 or other types of HOLTEK microcontrollers, you can download it at the following address: http://www.holtek.com.cn/referanc/htk_book.htm. The 12-clock mode (6-clock model) should be in the MCS51 series, where 12 system clocks are one machine cycle, and 2 system clocks are one state, that is, one machine cycle has 6 states. 33. What are the advantages of the sampling rate of A/D and D/A compared with other microcontrollers? Answer: The HOLTEK A/D Tyep MCU has an embedded bit-by-bit approximation A/D conversion circuit with an accuracy of 8bit/9bit/10bit, and the fastest A/D conversion time is 76us. As for D/A, it generally refers to PWM output. HOLTEK A/D Type MCUs all have 8-bit PWM output, but the characteristic of HOLTEK PWM is that its output frequency is determined by the system frequency (that is, after the system frequency is selected, the PWM frequency is also determined), and its duty cycle is controlled by assigning values to the [PWM] register, and does not need to occupy the timer/counter resources. 34. When using AT89S51, the reset button is pressed and the data in the RAM is modified. What's going on? Note: The data is placed outside the special register. Answer: If it is the reset button of the RESET pin: Generally, the RESET reset of the MCU will reinitialize its special registers, while the values of the general registers will remain unchanged. If the reset button is a power reset: That is the power-on reset of the MCU, its special registers will be initialized, and the values of the general registers are random numbers. 35. P2.7 is used to drive an NPN transistor, and a 1K resistor is connected in series in the middle. The problem is: when I try to write '1' to P2.7, I find that the pin can only output a level of about 0.5V. Is this circuit used properly? How to use the IO function correctly? A: Is it a problem encountered during simulation or after burning the chip? You can disconnect the external circuit of P2.7 first and measure whether the output voltage is normal. If the output voltage is normal after disconnection, it means that the driving ability of P2.7 is insufficient and cannot drive the NPN transistor. PNP transistor should be used instead (generally in MCU applications, PNP driving is adopted). If the output voltage is still abnormal after disconnection, it is possible that the emulator (or chip) is damaged. 36. When doing charging management, increasing the frequency of PWM often comes at the expense of accuracy. If the frequencies of AT90S4433 (avr) and 78P458 (elan) used are 16kHz (8bit) and 32kHz (8bit) respectively, and you want to achieve 100kHz (above 8bit), such as atiny15. What should I do? A: The PWM you mentioned controls its frequency and duty cycle through a timer/counter, so if you want to increase the frequency, the accuracy will inevitably be reduced. If you want to increase the frequency of PWM, you can only solve it by increasing the system oscillation frequency. 37.Are MCUs used in automotive electronics mostly 8-bit or 32-bit? How do you view the prospects of MCUs in the automotive electronics market? Answer: Today, automobile manufacturing is also a rapidly advancing industry, especially the application of electronics in automobiles, which enables a variety of new functions to be realized. In general, automotive electronics applications are divided into three parts. l Automobile engine control: speed limit control, turbocharging, fuel injection control, etc. l Automobile comfort devices: remote anti-theft system, automatic air conditioning system, audio and video playback system, satellite navigation system, etc. l Automobile control and braking: anti-lock braking system (ABS), traction control system (TCS), anti-skid system (ASR), electronic stability program (ESP), etc. There are many systems in the car, and they are changing with each passing day. Therefore, the type of MCU used depends on the specifications of each system, and the requirements are different, but one thing is certain that the MCU must meet industrial specifications to withstand the harsh environment, high temperature, power supply interference, and reliability requirements of automotive applications. Different grades of cars have different functional configurations, so there should be room for 8-bit MCUs in lower-level systems such as mechanical control and remote anti-theft, but high-level systems such as audio and video, navigation and future unmanned driving are not something that ordinary MCUs can achieve. Because the automobile industry is currently controlled by several large groups in Europe, the United States and Japan, the relevant automotive electronic parts groups will choose large MCU manufacturers for cooperation, so the built-in electronic systems of cars are also controlled by large MCU manufacturers, and the market only has external systems such as remote anti-theft, audio and video navigation for small manufacturers to develop. 38. When using Samsung's s3c72n4, I feel that its time/counter is not enough. Now I need to use 3 counters at the same time, what should I do? Answer: Do you need three external counters or three timers? If there are three timer flags, you can take the most basic time base of these three timings as the basic count of the timer, and then use this time base to calculate the flags of the three required counting flags. In the program, you only need to check whether the flag has arrived and then take action. If you want to count 3 external pulses, this is somewhat difficult. If the external pulses are not very frequent, you can consider using external interrupts, but this method must be that the frequency of the external pulses is a certain order of magnitude different from the MCU execution speed, otherwise the MCU may not be able to handle other programs and is always processing external interrupts. 39. With the increasing progress of chip integration technology, the integration technology of single-chip microcomputers is also developing rapidly. Based on the traditional 40-pin, Philips has launched a 20-pin single-chip microcomputer series, so that many pins can be reused. Will the use of this reuse technology affect the execution of its functions in actual applications? Answer: Now many brands of single-chip microcomputers have pin reuse functions, not just Philips. It should be said that this method has been available for several years. In actual applications, it will not affect the execution of its functions, but it should be noted that if some MCUs use multiplexing pins, the pins will have some application restrictions, which will be described in the corresponding datasheet, so you must pay attention to it when planning the system. 40. What is the concept of Delta-Sigma software measurement? Answer: The Delta-Sigma principle is generally used in ADC applications. Specifically, the working principle of Delta-Sigma ADC is that the modulator is composed of a differential, an integrator, and a comparator, which together form a feedback loop. The modulator runs at a rate much higher than the bandwidth of the analog input signal to provide oversampling. The analog input is differentially (delta) compared with the feedback signal (error signal). The differential output generated by this comparison is fed into the integrator (sigma). The output of the integrator is then fed into the comparator. The output of the comparator simultaneously transmits the feedback signal (error signal) to the differentiator, and itself is fed into the digital filter. The purpose of this feedback loop is to make the feedback signal (error signal) tend to zero. The result of the comparator output is a 1/0 stream. If the density of 1 is high, it means that the analog input voltage is high; conversely, if the density of 0 is high, it means that the analog input voltage is low. The 1/0 stream is then fed into the digital filter, which converts the 1/0 stream from a high-speed, low-precision bit stream to a low-speed, high-precision digital output through oversampling and sampling. In short, Delta means differential and Sigma means integration. Delta-Sigma software testing, as I understand it, is to simulate the differential integration process through software. Specifically, it is to detect the change of the voltage (or current) signal of the external input, and then obtain the basic situation of the external signal changing over time through software integration operation.
41. What methods are usually used to test the reliability of the MCU system? Answer: The MCU system can be divided into two aspects: software and hardware. If we want to ensure the reliability of the MCU system, we must start from these two aspects. First of all, when designing the MCU system, we should fully consider all kinds of possible external interference and try to use all means provided by the MCU to cut off or solve the impact of bad external interference. Let's take HOLTEK's most basic I/O MCU HT48R05A-1 as an example. It provides a watchdog timer WDT to prevent the internal program of the MCU from running randomly and making mistakes; it provides a low voltage reset system LVR. When the voltage is lower than a certain allowable value, the MCU will automatically RESET to prevent the chip from being locked; HOLTEK also provides the best peripheral circuit connection solution to avoid the impact of external interference on the chip as much as possible. When a MCU system is designed, there will be different test items and methods for different MCU system products, but there are some that must be tested: l Test the completeness of the MCU software function. This is a test for all MCU system functions to test whether the software is written correctly and completely. l Power-on and power-off test. During use, users will inevitably encounter power-on and power-off situations. You can switch the power on and off multiple times to test the reliability of the MCU system. l Aging test. Test the reliability of the MCU system under long-term operation. If necessary, it can be placed in a high temperature, high voltage and strong electromagnetic interference environment for testing. l ESD and EFT tests. Various interference simulators can be used to test the reliability of the MCU system. For example, use an electrostatic simulator to test the anti-static ESD capability of the MCU system; use a surge noise simulator to perform fast pulse anti-interference EFT tests, etc. Of course, if there are no such conditions, you can simulate the damage that may occur during human use. For example, deliberately rub the contact port of the MCU system with the human body or clothing fabric to test the anti-static capability. Use a high-power electric drill to work close to the MCU system to test the anti-electromagnetic interference capability, etc. 42. When developing a MCU system, what are the specific standards for measuring the stability of the system? Answer: From an industrial perspective, there are many standards for measuring system stability, and the standards are different for different products. Below we will briefly introduce the most commonly used standards for MCU systems. l Electrical Test (ESD) Reference Standard: IEC 61000-4-2 The purpose of this test is to test the degree to which the test piece can withstand the electrostatic discharge effect directly from the operator and the relative object. l Space Radiation Withstand Test (RS) Reference Standard: IEC 61000-4-3 This test is to verify the test piece's tolerance to the noise scattered by the RF generator through space. Test frequency: 80 MHz~1000 MHz l Fast Pulse Immunity Test (EFT/B) Reference Standard: IEC 61000-4-4 The purpose of this test is to verify the tolerance of the power line and signal line (control line) of the test piece to repeated fast instantaneous bursts. l Lightning Test (Surge) Reference Standard: IEC 61000-4-5 This test is to test the test piece's tolerance to the surge generated by the overvoltage/current generated by the switch or lightning when it is in operation. l Conducted Immunity Test (CS) Reference standard: IEC 61000-4-6 This test verifies the tolerance of the test piece to the noise conducted by the RF generator through the power line. Test frequency range: 150 kHz~80 MHz l Impulse Pulse is injected into the power line or control line through coupling to perform a random interference test. 43. When designing software, most microcontrollers have a watchdog. It is necessary to feed the dog at an appropriate position in the software to prevent the software from resetting and entering a dead loop. How to feed the dog appropriately, that is, how to accurately determine the running time of the software? Answer: Most microcontrollers have a watchdog timer function (WDT, Watch Dog Timer) to avoid program errors. HOLTEK has a basic I/O type microcontroller--HT48R05A-1, let's take it as an example to explain. First, let's understand the basic structure of WDT. It is actually a timer. The so-called feeding the dog means clearing this timer. There are two methods of feeding the dog: software and hardware. Software feeding the watchdog means using instructions to clear the WDT, namely CLR WDT; hardware feeding the watchdog means hardware reset RESET. When the timer overflows, it will cause the WDT to reset, which is what we often call the watchdog. When the program is executed normally, we do not want the WDT to reset, so we need to use software instructions to feed the watchdog before the watchdog overflows, that is, we need to calculate how long it takes for the WDT to overflow. The calculation formula for the WDT overflow time of the HT48R05A-1 is: 256*Div*Tclock. Among them, Div refers to the wdt pre-division number 1~128, and Tclock refers to the clock source period. If the internal RC oscillator is used as the clock source of the WDT (RC clock period is 65us/5V), the maximum WDT overflow time is 2.1 seconds. When we get the WDT overflow time Twdt, we generally choose to feed the watchdog at a time of about Twdt/2 to ensure that the watchdog will not overflow and the number of times the watchdog is fed will not be too many. The software running time is determined by different running routes. If the software running route can be predicted, the software running time can be calculated according to T=n*T1. n refers to the number of machine cycles of operation, and T1 refers to the machine cycle. HOLTEK microcontroller is a RISC structure, and most instructions consist of one machine cycle. You only need to know how many instructions the software runs to calculate the running time. There is a tool for calculating the running time in HOLTEK's compilation software HT-IDE3000. However, for CISC structure microcontrollers, an instruction can consist of several machine cycles, so it is necessary to calculate according to the specific instructions executed. 44. We are a professional factory that develops CNC systems. We have developed many products using various microcontrollers and CPUs. We have also adopted many common anti-interference technologies in software development, such as: software traps, instruction margin, watchdog and digital filtering, etc., but they are still very unreliable in actual use, such as: often inexplicable freezes, program jumps, I/O data errors, etc., and the repeatability of the fault is very uncertain, and it is not repeated periodically. Often, users experience a fault during use, but cannot reproduce it, which is a headache. Repeated hardware checks have not found the cause, so the reliability of the software is very doubtful. What should I do? Answer: The most effective way to prevent interference is to remove the interference source and cut off the interference path, but it is often difficult to do so, so we can only see whether the anti-interference ability of the microcontroller is strong enough. The most common phenomenon of microcontroller interference is reset; as for the program running away, in fact, the software trap and watchdog can also be used to pull the program back to the reset state; so the most important thing for the microcontroller software to resist interference is to handle the reset state well. Generally, the microcontroller will have some flag registers that can be used to determine the reset cause; in addition, you can also bury some flags in the RAM yourself. Every time the program is reset, by judging these flags, different reset causes can be determined; you can also jump directly to the corresponding program according to different flags. This can make the program run continuously, and the user will not notice that the program has been reset when using it. You can set some registers to accumulate in the timer interrupt, and then add them to the preset value (a relatively long time), SET flag bit, these actions are in the interrupt program. The main program only needs to query the flag bit, but remember to clear the flag bit after use, and also remember to clear the time base accumulator in the interrupt after use. 45.What aspects should be focused on in the application of single-chip microcomputers? Answer: The learning process can be basically divided into four stages: The first stage is to browse the hardware part in the textbook first, and roughly understand the hardware structure of the single-chip microcomputer. Such as ROM, RAM, address, I/O port, etc., and look at some manufacturers' Data Sheets, such as the HOLTEK website, which provides simplified versions of various MCU information, to strengthen the impression of the various resources provided by the IC. The second stage is to understand the content of binary numbers, hexadecimal numbers and software. Although there are many high-level languages that can be used for single-chip microcomputer programming, I think it is better to learn assembly language (i.e., assembly language) for beginners, which is more conducive to combining with hardware and mastering hardware structure. After knowing the concepts of assembly language, machine language, instructions, program, source program, and target program, start with the MOV instruction to learn assembly language and programming. Here, for example, the HOLTEK MCU assembly language system has 63 instructions, which is simple and easy to understand how they are connected to the hardware, and is more conducive to the general learning of single-chip microcomputer instruction integration and application. Therefore, the method is to first understand a few basic MOV instructions and its machine language, roughly establish the hardware and software concepts of the single-chip microcomputer, and know that the hardware of the single-chip microcomputer is controlled by instructions. The third stage is to familiarize yourself with the use of the programmer according to the user manual of the programmer. Nowadays, programmers are generally connected to computers. Anyone with basic computer knowledge can quickly master the operation steps. If beginners want to quickly familiarize themselves with the development system of the single-chip microcomputer, HOLTEK provides detailed operation information of the single-chip microcomputer development system. You can go to the HOLTEK website (www.holtek.com.cn) to download the HT-IDE3000 user manual. The fourth stage is to rely on the experimental board to learn and master the combination language instruction system and simple programming of the single-chip microcomputer. At the same time, it is combined with the hardware knowledge learned previously, which plays a dual role of learning the software and consolidating the hardware. At the beginning, you can use simple programs written by others to verify and analyze on the experimental board. The main purpose is to familiarize yourself with the learning method. In terms of application, it mainly focuses on the use of various interfaces of the microcontroller I/O, such as the application of A/D, D/A, PWM output ports, LCD and VFD control, and how to standardize the communication protocols of various serial output ports. The driving capabilities of the components it controls must be analyzed first, such as current and voltage issues. 46. What is the difference between the application and development of microcontrollers in the world today? Answer: Application and development are two sides of the same coin. They are market-oriented. When there is market demand, planning and analysis at the application level guide the development of microcontrollers in this direction. 47. In China, what aspects of microcontrollers have better prospects? Answer: Observing the sales region proportions of various manufacturers in the past few years, it can be found that the proportion of the Chinese mainland market has gradually increased, while the Taiwan and North American markets have gradually declined. The main reason is that many product manufacturing bases have been transferred to the mainland, and the demand for MCUs in the mainland has also increased accordingly. MCU products sold to China are mostly used in telephones, caller ID, toys and LCD products. It is expected that the proportion of sales to China will continue to increase in the future. The application areas of products in China can be divided into five major projects, including computer peripherals (high-speed modem, DSC, power management in NB, etc.), communication industry, consumer products (home appliances, air conditioners, etc.), automotive market (speed controllers, controllers, anti-theft devices) and industrial applications. Some manufacturers will specifically target the consumer product market, such as the audio method will move towards multimedia and MP3 solutions. In addition, in PC connection applications, including wireless, network and standard application products, a series of products will be launched. In addition, in the power system application, in UPS (uninterruptible power supply system), Server Power (server power supply), Charger (charger) and other applications; and in the peripheral application field, for Game Device, memory card, card reader, Pen Drive (USB flash drive) and other applications. Logic ICs include microprocessors (MPUs), microcontrollers (MCUs), application-specific ICs (ASICs), programmable logic devices (PLDs), and general standard application ICs (ASSPs). Different logic ICs have their own development directions, while MCU products are developing towards integrated products, hoping to add more functions to a single IC to reduce the difficulty and cost of user system design. 48. Although there are many 16-bit ICs, low-end users still use 4 and 8-bit ICs. Those with high performance requirements can now choose 32-bit MCUs. 16-bit ICs can only play a transitional role. Is this correct? Answer: Basically, it can be said that microcontrollers have gone through the development process of 4-bit, 8-bit, 16-bit and 32-bit, and many manufacturers have invested in them. They are also ubiquitously used in various areas of life. As long as it is related to the operating interface, you can find traces of MCUs. The number of MCUs used has even become one of the indicators for evaluating income and economic conditions abroad. Due to the steady sales of automobiles, home appliances and consumer electronics products, the MCU market will be full of vitality in 2003. In the 32-bit MCU market, the fastest growing area is still the automobile, mobile phone with Internet access, PDA, printer, digital camera, high-speed MODEM and other applications due to the large demand for it. Market institutions predict that it will grow by 30% in 2003 and 38% in 2004. Although the 32-bit market has great growth potential, there are only a few manufacturers that can focus on 32-bit. Whether it is domestic or foreign IC suppliers, the current product development strategy is still focused on the 8-bit market, and 8-bit and 32-bit MCUs have also become the targets of manufacturers to enter the development. As for 16-bit MCU products, although the speed is faster than 8-bit, due to the awkward position of 16-bit between 8 and 32, and the price of 32-bit is also close to 16-bit, the industry has paid less attention to 16-bit products. 49. What should I pay attention to and how to start the transition from the original 51 system to the ARM system? Answer: It is relatively difficult to convert the 51 system to the ARM system. ARM provides a series of cores, system extensions, microprocessors and system chip solutions, and has developed several cores. The main ones are as follows: l ARM7: small, fast, low-power, integrated RISC core l ARM7TDMI (Thumb): It combines the ARM7 instruction set with the Thumb extension to reduce memory capacity and system cost; it also uses embedded ICE debugging technology to simplify system design; and has DSP enhancement extensions to improve performance. l ARM9TDMI: uses a 5-stage pipelined ARM9 core, equipped with Thumb extensions, debugging and Harvard bus. If you just want to learn, it is recommended to make a minimum system board first, and write a small startup code based on the hardware, including initializing ports, shielding interrupts, copying programs to SRAM; completing code remapping; configuring interrupt handles, and connecting to C language entry. In fact, more practice, more experience, more visits to electronic websites, and absorbing other people's development experience will help your growth. 50. Is Holtek's programming statement C51 or related? Can you introduce information or website addresses related to automotive electronic design? Answer: HOLTEK programming statements are different from MCS51 in terms of assembly instructions, but many instructions are similar; and C language, each company's C compiler will be a little different, but many are similar to TURBO C, so there is still a lot of similarity, so the readability is much better than assembly language, but there are still some differences between different manufacturers. For an introduction to HOLTEK C language, please download http://www.holtek.com.cn/referanc/ht-ide3k.pdf, which is introduced in detail in Chapter 10. As for information or website addresses about automotive electronic design, you can search on GOOGLE, there should be more links.pdf, Chapter 10 has a detailed introduction. You can search for information or website addresses about automotive electronic design on GOOGLE, and there should be more link addresses.pdf, Chapter 10 has a detailed introduction. You can search for information or website addresses about automotive electronic design on GOOGLE, there should be more link addresses.What is the difference between the application and development of single-chip microcomputers in the world today? Answer: Application and development are two sides of the same coin. They are market-oriented. When there is market demand, planning and analysis at the application level guide the development of single-chip microcomputers in this direction. 47. In China, in which areas do single-chip microcomputers have better prospects? Answer: Observing the sales area proportions of various manufacturers in the past few years, it can be found that the proportion of the Chinese mainland market has gradually increased, while the Taiwan and North American markets have gradually declined. The main reason is that many product manufacturing bases have been transferred to the mainland, and the demand for MCUs in the mainland has also increased. MCU products sold to the mainland are mostly used in products such as telephones, caller IDs, toys and LCDs. It is expected that the proportion of sales to the mainland will continue to increase in the future. The application areas of products in China can be divided into five major projects, including computer peripherals (high-speed modems, DSCs, power management in NBs, etc.), communications industry, consumer products (home appliances, air conditioners, etc.), automotive market (speed controllers, controllers, anti-theft devices) and industrial applications. Some manufacturers will specifically target the consumer product market. For example, the audio method will move towards multimedia and MP3 solutions. In addition, in PC connection applications, including wireless, network and standard application products, a series of products will be launched. In addition, in power system applications, in UPS (uninterruptible power supply system), Server Power (server power supply), Charger (charger) and other applications; and in peripheral application fields, for Game Device, memory card, card reader, and Pen Drive (portable disk) and other applications. Logic IC includes microprocessor (MPU), microcontroller (MCU), special application IC (ASIC), programmable logic device (PLD) and general standard application IC (ASSP). Different logic ICs have their own development direction, and MCU products are developing towards integrated products, hoping to add more functions to a single IC to reduce the difficulty and cost of users in system design. 48. Although there are many 16-bit, the real low-end users still use 4 and 8 bits. Those with high performance requirements can now choose 32-bit microcontrollers. And 16-bit can only play a transitional role. Is this correct? Answer: Basically, we can say that microcontrollers have gone through the development process of 4-bit, 8-bit, 16-bit and 32-bit, and many manufacturers have invested in them. They are also ubiquitously used in various areas of life. As long as it is related to the operating interface, you can find traces of MCU. The number of MCUs used has even become one of the indicators for evaluating income and economic conditions abroad. Due to the stable sales of automobiles, home appliances and consumer electronics products, the MCU market will be full of vitality in 2003. In the 32-bit MCU market, the fastest growing area is still due to the large demand for automobiles, Internet-enabled mobile phones, PDAs, printers, digital cameras, high-speed MODEMs and other applications. Market institutions predict that it will grow by 30% in 2003 and 38% in 2004. Although the 32-bit market has great growth potential, there are only a few manufacturers that can focus on 32-bit. Whether it is domestic or foreign IC suppliers, the current product development strategy is still focused on the 8-bit market, and 8-bit and 32-bit MCUs have also become the targets of manufacturers to enter the development. As for 16-bit MCU products, although the speed is faster than 8-bit, 16-bit is in an awkward position between 8 and 32, and the price of 32-bit is close to 16-bit, so the industry pays less attention to 16-bit products. 49. What should I pay attention to and how to start the transition from the original 51 system to the ARM system? Answer: It is relatively difficult to convert the 51 system to the ARM system. ARM provides a series of cores, system extensions, microprocessors and system chip solutions, and has developed several cores. The main ones are as follows: l ARM7: small, fast, low-power, integrated RISC core l ARM7TDMI (Thumb): It combines the ARM7 instruction set with the Thumb extension to reduce memory capacity and system cost; it also uses embedded ICE debugging technology to simplify system design; and has DSP enhancement extensions to improve performance. l ARM9TDMI: uses a 5-stage pipelined ARM9 core, equipped with Thumb extensions, debugging and Harvard bus. If you just want to learn, it is recommended to make a minimum system board first, and write a small startup code based on the hardware, including initializing ports, shielding interrupts, copying programs to SRAM; completing code remapping; configuring interrupt handles, and connecting to C language entry. In fact, more practice, more experience, more visits to electronic websites, and absorbing other people's development experience will help your growth. 50. Is Holtek's programming statement C51 or related? Can you introduce information or website addresses related to automotive electronic design? Answer: HOLTEK programming statements are different from MCS51 in terms of assembly instructions, but many instructions are similar; and C language, each company's C compiler will be a little different, but many are similar to TURBO C, so there is still a lot of similarity, so the readability is much better than assembly language, but there are still some differences between different manufacturers. For an introduction to HOLTEK C language, please download http://www.holtek.com.cn/referanc/ht-ide3k.pdf, which is introduced in detail in Chapter 10. As for information or website addresses about automotive electronic design, you can search on GOOGLE, there should be more links.What is the difference between the application and development of single-chip microcomputers in the world today? Answer: Application and development are two sides of the same coin. They are market-oriented. When there is market demand, planning and analysis at the application level guide the development of single-chip microcomputers in this direction. 47. In China, in which areas do single-chip microcomputers have better prospects? Answer: Observing the sales area proportions of various manufacturers in the past few years, it can be found that the proportion of the Chinese mainland market has gradually increased, while the Taiwan and North American markets have gradually declined. The main reason is that many product manufacturing bases have been transferred to the mainland, and the demand for MCUs in the mainland has also increased. MCU products sold to the mainland are mostly used in products such as telephones, caller IDs, toys and LCDs. It is expected that the proportion of sales to the mainland will continue to increase in the future. The application areas of products in China can be divided into five major projects, including computer peripherals (high-speed modems, DSCs, power management in NBs, etc.), communications industry, consumer products (home appliances, air conditioners, etc.), automotive market (speed controllers, controllers, anti-theft devices) and industrial applications. Some manufacturers will specifically target the consumer product market. For example, the audio method will move towards multimedia and MP3 solutions. In addition, in PC connection applications, including wireless, network and standard application products, a series of products will be launched. In addition, in power system applications, in UPS (uninterruptible power supply system), Server Power (server power supply), Charger (charger) and other applications; and in peripheral application fields, for Game Device, memory card, card reader, and Pen Drive (portable disk) and other applications. Logic IC includes microprocessor (MPU), microcontroller (MCU), special application IC (ASIC), programmable logic device (PLD) and general standard application IC (ASSP). Different logic ICs have their own development direction, and MCU products are developing towards integrated products, hoping to add more functions to a single IC to reduce the difficulty and cost of users in system design. 48. Although there are many 16-bit, the real low-end users still use 4 and 8 bits. Those with high performance requirements can now choose 32-bit microcontrollers. And 16-bit can only play a transitional role. Is this correct? Answer: Basically, we can say that microcontrollers have gone through the development process of 4-bit, 8-bit, 16-bit and 32-bit, and many manufacturers have invested in them. They are also ubiquitously used in various areas of life. As long as it is related to the operating interface, you can find traces of MCU. The number of MCUs used has even become one of the indicators for evaluating income and economic conditions abroad. Due to the stable sales of automobiles, home appliances and consumer electronics products, the MCU market will be full of vitality in 2003. In the 32-bit MCU market, the fastest growing area is still due to the large demand for automobiles, Internet-enabled mobile phones, PDAs, printers, digital cameras, high-speed MODEMs and other applications. Market institutions predict that it will grow by 30% in 2003 and 38% in 2004. Although the 32-bit market has great growth potential, there are only a few manufacturers that can focus on 32-bit. Whether it is domestic or foreign IC suppliers, the current product development strategy is still focused on the 8-bit market, and 8-bit and 32-bit MCUs have also become the targets of manufacturers to enter the development. As for 16-bit MCU products, although the speed is faster than 8-bit, 16-bit is in an awkward position between 8 and 32, and the price of 32-bit is close to 16-bit, so the industry pays less attention to 16-bit products. 49. What should I pay attention to and how to start the transition from the original 51 system to the ARM system? Answer: It is relatively difficult to convert the 51 system to the ARM system. ARM provides a series of cores, system extensions, microprocessors and system chip solutions, and has developed several cores. The main ones are as follows: l ARM7: small, fast, low-power, integrated RISC core l ARM7TDMI (Thumb): It combines the ARM7 instruction set with the Thumb extension to reduce memory capacity and system cost; it also uses embedded ICE debugging technology to simplify system design; and has DSP enhancement extensions to improve performance. l ARM9TDMI: uses a 5-stage pipelined ARM9 core, equipped with Thumb extensions, debugging and Harvard bus. If you just want to learn, it is recommended to make a minimum system board first, and write a small startup code based on the hardware, including initializing ports, shielding interrupts, copying programs to SRAM; completing code remapping; configuring interrupt handles, and connecting to C language entry. In fact, more practice, more experience, more visits to electronic websites, and absorbing other people's development experience will help your growth. 50. Is Holtek's programming statement C51 or related? Can you introduce information or website addresses related to automotive electronic design? Answer: HOLTEK programming statements are different from MCS51 in terms of assembly instructions, but many instructions are similar; and C language, each company's C compiler will be a little different, but many are similar to TURBO C, so there is still a lot of similarity, so the readability is much better than assembly language, but there are still some differences between different manufacturers. For an introduction to HOLTEK C language, please download http://www.holtek.com.cn/referanc/ht-ide3k.pdf, which is introduced in detail in Chapter 10. As for information or website addresses about automotive electronic design, you can search on GOOGLE, there should be more links.Although 16-bit is also common, the real low-end users still use 4-bit and 8-bit. Those who require high performance can now choose 32-bit microcontrollers. And 16-bit can only play a transitional role. Is this correct? Answer: Basically, it can be said that microcontrollers have gone through the development process of 4-bit, 8-bit, 16-bit and 32-bit, and many manufacturers have invested in them. They are also ubiquitously used in various fields of life. As long as it is related to the operating interface, you can find traces of MCU. The number of MCUs used has even become one of the indicators for evaluating income and economic conditions abroad. Due to the steady sales of automobiles, home appliances and consumer electronics products, the MCU market will be full of vitality in 2003. In the 32-bit MCU market, the fastest growing field is still due to the large demand for it in automobiles, Internet-enabled mobile phones, PDAs, printers, digital cameras, high-speed MODEMs and other applications. Market institutions predict that it will grow by 30% in 2003 and 38% in 2004. Although the 32-bit market has great growth potential, there are only a few manufacturers that can focus on 32-bit. Whether it is domestic or foreign IC suppliers, the current product development strategy is still focused on the 8-bit market, and 8-bit and 32-bit MCUs have also become the targets of manufacturers to enter the development. As for 16-bit MCU products, although the speed is faster than 8-bit, 16-bit is in an awkward position between 8 and 32, and the price of 32-bit is close to 16-bit, so the industry pays less attention to 16-bit products. 49. What should I pay attention to and how to start the transition from the original 51 system to the ARM system? Answer: It is relatively difficult to convert the 51 system to the ARM system. ARM provides a series of cores, system extensions, microprocessors and system chip solutions, and has developed several cores. The main ones are as follows: l ARM7: small, fast, low-power, integrated RISC core l ARM7TDMI (Thumb): It combines the ARM7 instruction set with the Thumb extension to reduce memory capacity and system cost; it also uses embedded ICE debugging technology to simplify system design; and has DSP enhancement extensions to improve performance. l ARM9TDMI: uses a 5-stage pipelined ARM9 core, equipped with Thumb extensions, debugging and Harvard bus. If you just want to learn, it is recommended to make a minimum system board first, and write a small startup code based on the hardware, including initializing ports, shielding interrupts, copying programs to SRAM; completing code remapping; configuring interrupt handles, and connecting to C language entry. In fact, more practice, more experience, more visits to electronic websites, and absorbing other people's development experience will help your growth. 50. Is Holtek's programming statement C51 or related? Can you introduce information or website addresses related to automotive electronic design? Answer: HOLTEK programming statements are different from MCS51 in terms of assembly instructions, but many instructions are similar; and C language, each company's C compiler will be a little different, but many are similar to TURBO C, so there is still a lot of similarity, so the readability is much better than assembly language, but there are still some differences between different manufacturers. For an introduction to HOLTEK C language, please download http://www.holtek.com.cn/referanc/ht-ide3k.pdf, which is introduced in detail in Chapter 10. As for information or website addresses about automotive electronic design, you can search on GOOGLE, there should be more links.Although 16-bit is also common, the real low-end users still use 4-bit and 8-bit. Those who require high performance can now choose 32-bit microcontrollers. And 16-bit can only play a transitional role. Is this correct? Answer: Basically, it can be said that microcontrollers have gone through the development process of 4-bit, 8-bit, 16-bit and 32-bit, and many manufacturers have invested in them. They are also ubiquitously used in various fields of life. As long as it is related to the operating interface, you can find traces of MCU. The number of MCUs used has even become one of the indicators for evaluating income and economic conditions abroad. Due to the steady sales of automobiles, home appliances and consumer electronics products, the MCU market will be full of vitality in 2003. In the 32-bit MCU market, the fastest growing field is still due to the large demand for it in automobiles, Internet-enabled mobile phones, PDAs, printers, digital cameras, high-speed MODEMs and other applications. Market institutions predict that it will grow by 30% in 2003 and 38% in 2004. Although the 32-bit market has great growth potential, there are only a few manufacturers that can focus on 32-bit. Whether it is domestic or foreign IC suppliers, the current product development strategy is still focused on the 8-bit market, and 8-bit and 32-bit MCUs have also become the targets of manufacturers to enter the development. As for 16-bit MCU products, although the speed is faster than 8-bit, 16-bit is in an awkward position between 8 and 32, and the price of 32-bit is close to 16-bit, so the industry pays less attention to 16-bit products. 49. What should I pay attention to and how to start the transition from the original 51 system to the ARM system? Answer: It is relatively difficult to convert the 51 system to the ARM system. ARM provides a series of cores, system extensions, microprocessors and system chip solutions, and has developed several cores. The main ones are as follows: l ARM7: small, fast, low-power, integrated RISC core l ARM7TDMI (Thumb): It combines the ARM7 instruction set with the Thumb extension to reduce memory capacity and system cost; it also uses embedded ICE debugging technology to simplify system design; and has DSP enhancement extensions to improve performance. l ARM9TDMI: uses a 5-stage pipelined ARM9 core, equipped with Thumb extensions, debugging and Harvard bus. If you just want to learn, it is recommended to make a minimum system board first, and write a small startup code based on the hardware, including initializing ports, shielding interrupts, copying programs to SRAM; completing code remapping; configuring interrupt handles, and connecting to C language entry. In fact, more practice, more experience, more visits to electronic websites, and absorbing other people's development experience will help your growth. 50. Is Holtek's programming statement C51 or related? Can you introduce information or website addresses related to automotive electronic design? Answer: HOLTEK programming statements are different from MCS51 in terms of assembly instructions, but many instructions are similar; and C language, each company's C compiler will be a little different, but many are similar to TURBO C, so there is still a lot of similarity, so the readability is much better than assembly language, but there are still some differences between different manufacturers. For an introduction to HOLTEK C language, please download http://www.holtek.com.cn/referanc/ht-ide3k.pdf, which is introduced in detail in Chapter 10. As for information or website addresses about automotive electronic design, you can search on GOOGLE, there should be more links.
51. How do you understand the following concepts: MTP = Multi-Time Programming (via parallel programmer) ISP = In-System Programming (via serial interface) IAP = In-Application Programming? Answer: MTP means that the program of the microcontroller can be repeatedly burned. Its program memory (Program ROM) can be divided into the following types: l Window with EPROM: Provides space for users to change programs, has a window-type ceramic package, uses ultraviolet light to clear data, and can be repeatedly burned, but the packaging cost is very high, and it is only suitable for small-scale production or experimental use. l EEPROM: It is a component that can be repeatedly written/erased. This type of memory allows the content of the program to be cleared or modified without using a window-opening package, which can save packaging costs and is also convenient for repeated use, but the production process is more complicated. l Flash EPROM: When a large amount of non-volatile program memory needs to be cleared/written, Flash EPROM can provide a better solution than traditional EEPROM, because Flash EPROM performs better than EEPROM in terms of the number of clear/write cycles and speed. Using Flash ROM as program memory, since the package does not require the special window-type ceramic package of EPROM, the price is not much different from OTP (One Time Programming), which is quite reasonable, and it has the function of repeated burning. ISP (In-System Programming) is programmable in the system, which means that the blank device on the circuit board can be programmed to write the end-user code without removing the device from the circuit board. The programmed device can also be erased or reprogrammed using the ISP method. The implementation of ISP is relatively simple, and generally requires very little external circuit assistance. The general practice is that the internal memory can be rewritten by the software of the host computer through the serial port. For the single-chip microcomputer, the data sent by the host computer can be received through SPI or other serial interfaces and written into the memory. Therefore, even if we solder the chip on the circuit board, as long as we leave this serial port for the interface with the host computer, we can rewrite the internal memory of the chip without removing the chip. Advantages of ISP The advantage of ISP technology is that it does not require a programmer to conduct experiments and development of single-chip microcomputers. The single-chip microcomputer chip can be directly soldered to the circuit board, and the finished product is completed after debugging. This eliminates the inconvenience caused by frequent insertion and removal of chips to the chip and circuit board during debugging. IAP (In-Application Programming) means that the MCU can obtain new code in the system and reprogram itself, that is, the program can be changed by the program. The implementation of IAP is relatively complicated. When implementing the IAP function, there must be two storage areas inside the single-chip microcomputer, generally one is called the BOOT area, and the other is called the storage area. The single-chip microcomputer is powered on and runs in the BOOT area. If the conditions for external rewriting of the program are met, the program in the storage area is rewritten. If the conditions for external rewriting of the program are not met, the program pointer jumps to the storage area and starts to execute the program placed in the storage area, thus realizing the IAP function. IAP technology maps the Flash memory into two storage areas from a structural perspective. When running a user program on one storage area, the other storage area can be reprogrammed, and then the program is transferred from one storage area to another. Advantages of IAP IAP technology maps the Flash memory into two storage bodies from a structural point of view. When the user program on one storage body is running, the other storage body can be reprogrammed, and then the program can be transferred from one storage body to another. The implementation of IAP is more flexible. Usually, the serial port of the microcontroller can be connected to the RS232 port of the computer, and the internal memory can be programmed through a specially designed firmware program. Remote upgrades and maintenance can be easily achieved through the existing INTERNET or other communication methods. 52. There are many types of microcontroller development system products on the market. If you want to develop a 51 series microcontroller, what type of emulator and programmer (one piece at a time) is better? Answer: As you said, there are many types of emulator products for the 51 series microcontroller. As for which type of emulator to choose, because HOLTEK's IC is not a 51 core, the emulators are all developed by HOLTEK itself, so I can't give you very good suggestions. Moreover, there are many 51 emulators on the market, ranging in price from 1500 to 10000, so if you want to choose, you can google the forums related to emulators on the Internet, see other users' comments, and choose the emulator with the best cost performance. 53. Does HOLTEK's C language have instructions for bit operations and reading defined register addresses? If so, what are they? Answer: HOLTEK's C language is similar to standard C. It not only has standard C bit operations, & (bitwise AND, bitwise OR), ^ (bitwise XOR), ~ (negation), << (left shift) and >> (right shift); it also has corresponding built-in functions to implement left and right shifts with and without carry for integers and long integers. The operation of the address of defined variables is also the same as standard C, which can be achieved through pointer operators * and &. 54. After completing the program writing and running, the result is that all the memory from R0 to R7 is occupied, but I didn't use a few of them at all. Why is this? A: It depends on the type of microcontroller used. The definitions of R0 to R7 are different for different types of microcontrollers. If R0~R7 are defined as special registers, then these registers will naturally be affected during operation. For example, the execution of the operation program will affect the value of the status special register. If R0~R7 are defined as general registers, then they may not be initialized at the beginning of the program. When the microcontroller is powered on and reset, the value of the general register is usually random. 55. Please recommend some better theoretical and practical teaching materials, and their matching compilation, simulation and burning hardware and software? A: Today's microcontroller market is diverse and widely used. Take HOLTEK as an example. HOTLEK's microcontroller is an 8-bit microcontroller with a RISC structure. It can be widely used in household appliances, security systems, handheld games, etc. Generally speaking, it can be divided into I/O type microcontrollers, LCD type microcontrollers, A/D type microcontrollers, A/D with LCD type microcontrollers, etc. We have made the Chinese information of these microcontrollers public on the HOLTEK website www.Holtek.com.cn. Download address of user manuals of various HOLTEK MCUs: http://www.holtek.com.cn/referanc/htk_book.htm; Download address of HOLTEK MCU software/hardware application examples: http://www.holtek.com.cn/tech/appnote/appnote.htm; Download address of HOLTEK MCU support tools: http://www.holtek.com.cn/tech/tool/tool.htm. 56. What are the methods to achieve PWM at 100kHz (above 8bit)? It is best to support C compilation. Answer: To achieve PWM frequency above 100kHz (8bit), the frequency of the MCU is required to be 100kHz*256=25.6MHz. Therefore, the MCU to achieve this requirement needs to meet two conditions: 1. The MCU has PWM output; 2. The system frequency reaches 25.6MHz, or the microcontroller can provide a 25.6MHz frequency (ATtiny15 has a 25.6MHz frequency as the timer/counter clock). 57.The chairman of ARM believes that medical electronics will become the driving force for the growth of the electronics industry in the next 10 years. EMS predicts that medical electronics will become the largest foundry market. Bluetooth enhances the mobility of medical products and will be widely used. So with the development of medical electronics, will the application of single-chip microcomputers in this field become larger? How many single-chip microcomputers are used in medical electronics at most? Answer: With the development of 16/32-bit embedded RISC, the application in the field of medical electronics will be expanded. The general electronic health care series products are as follows: pen-type electronic thermometers, baby pacifier-type electronic thermometers, temperature-measuring music bottles, women's electronic thermometers, electronic blood pressure monitors and other products. In medical electronic instruments, there are pH meters, colorimeters and other products that can be completed with 8-bit single-chip microcomputers. However, from the research and manufacturing perspective, for medical electronic instruments, there are already manufacturers manufacturing electrocardiographs, pH meters, electronic thermometers and other instruments. The instrument center can make its own oscilloscopes, microscopes, X-ray machines, ultrasound diagnostic equipment, computer tomography systems, pacemakers, monitors, auxiliary diagnostic systems, expert systems, etc. Large-scale medical embedded system electronic instruments must be completed with 16-bit and 32-bit microcontrollers. 58. The operating temperature range of ordinary commercial-grade microcontrollers is 0-70 degrees. What problems will occur when used in environments below 0 degrees and above 70 degrees? In addition to the different temperature ranges, are there any other differences between commercial-grade chips and industrial-grade chips? (Such as anti-interference performance) Answer: Generally, microcontrollers can be divided into three types according to the operating temperature: civil-grade (commercial-grade), industrial-grade and military-grade: the civil-grade temperature range is 0℃~70℃, the industrial-grade is -40℃~85℃, and the HOLTEK MCU belongs to this level. The military-grade is -55℃~125℃. If it is a general commercial-grade microcontroller, when the IC is used beyond the specification range, some ICs may not work or work abnormally. As for the anti-interference performance, it belongs to the EMS (electromagnetic noise tolerance) test of the entire product. It is one of the tests in EMC (electromagnetic compatibility), and the other is EMI (electromagnetic radiation interference). Each country has its own EMC certification standards. For example, under the commonly used test specifications under the European EMC directive, the regulation EN61000-4-2 is an electrostatic test (ESD). The purpose of this test is to test the degree to which the test piece can withstand the electrostatic discharge effect directly from the operator and the relative object. The regulations are as follows: l Air Discharge l Leve1 2KV l Leve2 4KV l Leve3 8KV l Leve4 15KV The above is an example. Just like the anti-static ability, it is not only related to IC performance, but also directly related to the application circuit and PCB Layout. 59. How do various inputs communicate with MCU? Answer: First, it is necessary to determine whether such input signals are compatible with the signal level of the MCU system. If they are not compatible, an external circuit or an integrated block is required to complete the level conversion. The second is to choose the communication method. The basic communication methods are divided into parallel communication and serial communication. Both have their advantages and disadvantages. Parallel communication is fast, but the disadvantage is that as many transmission lines are required as the number of data bits. This is not suitable when there are many bits and the transmission distance is long; serial communication is the opposite of the former, with low transmission cost but low transmission speed. Finally, in order to ensure the success of communication, the communicating parties must have a series of agreements, namely communication protocols, which must make clear provisions on when to start communication, when to end communication, when to exchange information, etc. 60. Which model of 51 single-chip microcomputer has two serial ports, 16KEPROM, and 512 bytes of RAM? Answer: PHILIPS Semiconductor's P87C591 should be able to meet this condition. Currently, semiconductor manufacturers that produce 51 single-chip microcomputers include INTEL, ATMEL, PHILIPS, ANANOG DEVICES, DALLAS, etc. You can log on to their websites to query the corresponding product information.
61. What are the problems of software anti-interference in embedded development? How to solve them? Answer: Regarding software anti-interference problems and strategies, if these principles can be followed well in actual applications, and then combined with anti-interference measures of hardware circuits, the interference effects can be basically eliminated. But sometimes, due to the complexity of the program itself and the limitation of chip resources, coupled with the limitation of the programmer's own ability, it cannot be perfect. So we can only give some suggestions. As for the specific implementation, you need to constantly explore and accumulate experience in your usual project practice. The following is the answer to the previous question about software anti-interference, for reference only: The most effective way to prevent interference is to remove the interference source and cut off the interference path, but it is often difficult to do so, so we can only see whether the anti-interference ability of the microcontroller is strong enough. The most common phenomenon of microcontroller interference is reset; as for the program running away, in fact, you can also use software traps and watchdogs to pull the program back to the reset state; so the most important thing for microcontroller software anti-interference is to handle the reset state well. Generally, microcontrollers have some flag registers that can be used to determine the cause of the reset; in addition, you can also bury some flags in RAM yourself. Each time the program is reset, by judging these flags, different reset reasons can be judged; you can also jump directly to the corresponding program according to different flags. This allows the program to run continuously, and users will not notice that the program has been reset when using it. 62. Will voice recognition be the next consumer hotspot for microcontrollers? Answer: Voice recognition has been used in low-end toys many years ago, such as the left and right front and back control of remote control cars. Educational toys use voice to compress and encode the words and store them according to the length that the memory can accommodate. When the same voice is sent again in the future, it can be processed and recognized by the microcontroller and the corresponding action can be taken. Depending on the cost, the related MCU resources and speed, the quality of the recognition technology algorithm used, the size of the memory, etc., the recognition rate and word length of the designed products are also very different. This low-end market should have a bright future with the current drop in chip prices. It depends on whether the innovative product applications are attractive! High-end speech recognition applications are on PCs (personal computers), which have CPU-level resource speeds and hard disk memory capacities, but this market has nothing to do with hardware (single-chip microcomputers)! Another speech recognition application is embedded systems. For example, most current mobile phones are equipped with speech recognition phone books. In fact, general embedded systems such as PDAs, DSCs, MP3s, etc. have the ability to build in this function. It depends on how much hardware resources are needed and the effect that can be achieved. The functional positioning of the product is very important. Whether speech recognition is necessary requires evaluating the actual usage rate! 63. How to design and implement a low-cost device for measuring battery pack voltage with a common mode range between 0 and 120V? Answer: The so-called high common mode input voltage here refers to the high range of in-phase input voltage. The following explains some concepts of op amps: Op amps have a so-called dynamic range, which refers to the output and input voltage range of the op amp (OP) when it is not saturated and in normal operation. Generally speaking, the larger the dynamic range, the higher the effective utilization rate of the power supply voltage. For example, when processing signals of the same level, there is no need to deliberately increase the power supply voltage to achieve energy saving effects. Especially in the case of portable consumer electronic products that require low voltage and low power consumption, high-efficiency power supply voltage has always been the focus of attention, especially the ground potential of the op amp. If it is set at the midpoint (i.e., the operating point) of the positive and negative power supply voltages of Vcc~VEE, an extremely wide dynamic range can be obtained. In view of this, designers usually make the input dynamic range larger than the output dynamic range without reducing the output dynamic range. When the potential of the input signal is VEE (power supply voltage), the polarity of some OPs will cause inversion. Although the output allows saturation caused by excessive input, in most cases, polarity inversion is not allowed. Therefore, when two single power supplies are used, the output will be reversed before the input signal of the op amp reaches VEE. It should be noted that even if the op amp is used with a single power supply, if it exceeds 0.5V below VEE, that is, VEE-0.5V, the output polarity may also be reversed. The so-called common-mode input voltage range VICM (common-mode input voltage) refers to the common-mode voltage range that can be applied between the two input terminals and the ground. Although the applied common-mode voltage will not cause component damage or other problems when it exceeds this range, it will stop the function of the operational amplifier. As long as the differential input voltage acts normally as an amplifier, it is basically 0 volts. It is an ideal state that the common-mode input voltage range VICM is the same as the positive and negative power supply voltages. Generally, the operational amplifier will use the CMR (common-mode signal elimination ratio) of the differential amplifier to remove the same components. When it is necessary to expand the common-mode range, the input Vs2 signal of the inverting amplifier A2 with a gain (Game) of 1/10 can be used, and the input Vs1 signal of the inverting amplifier A1 with a gain (Game) of 1/10 can be added in addition. In this way, differential amplification with an expanded common-mode input range can be achieved. If the common mode range is designed to be between 0 and 120V, the inverting amplifier A1 can use R1=100K, Rf=10K, and the inverting amplifier A2 can also use R1=100K, Rf=10K, and a 10K resistor is connected in series from the output of the inverting amplifier A1 to the negative input port of the inverting amplifier A2. 64. When using a single-chip microcomputer to control an LCD, the overflow interrupt of T1 is used to display the refresh clock information. In the main program loop, in order to display floating-point numbers, the spritf() function is continuously called, but the clock information is no longer refreshed. After disabling this function, it returns to normal. Will calling this function affect the interruption of the timer/counter? Answer: This should be related to the program. Generally speaking, the sprintf() function will not affect the interruption of the timer/counter. Because I haven't seen the specific program, I guess the reason may be that the part of the program that initializes the timer conflicts with the buffer used by sprintf(), causing the error of timer initialization. 65. What kind of IC is LM4915? Answer: LM4915 is an audio power amplifier, commonly used in low-voltage applications such as mobile phones with single handsets, PDAs and other portable audio devices. With very few external components, it provides high-quality power output to drive the sound-generating device. 66.RISC architecture microcontrollers are widely used nowadays. What are its main features? What are its advantages? And what are the characteristics of Harvard architecture in processors? Answer: In terms of MCU development, in terms of architecture, it can be divided into two major mainstreams: RISC (Reduced Instruction Set Computer) and CISC (Complex Instruction Set Computer). RISC means that all instructions of MCU are composed of some simple instructions. Simple instructions mean that the circuit of MCU can be optimized as much as possible, and the execution speed is improved, which relatively reduces the time required for an instruction to the shortest. HOLTEK's series of MCUs are designed with RISC structure. In addition, because RISC has a simplified instruction set, many tasks must be combined with simple instructions, and for more complex combinations of tasks, a "compiler" is required to execute. CISC MCU has more instruction sets provided by the hardware, so many tasks can be replaced by one or several instructions, and the compiler's work is thus reduced a lot. For example, in a numerical calculation program, an MCU using the CISC instruction set may only need ten machine instructions to calculate an integral operation. However, when executing the same program, a RISC MCU may need to execute hundreds of machine instructions (but each instruction may only take one-tenth of the time of a CISC instruction) because the CPU itself does not provide floating-point multiplication instructions. The action of converting the programming language into machine instructions is performed by the compiler of the programming language, so the compiler of the RISC MCU will be more complicated. Because the same high-level language A=B*C operation may have many combinations when converted into machine instructions in the RISC MCU, and the "time/space" combination of each combination is different. Therefore, the trade-off between RISC and CISC seems to be a balance between the MCU hardware architecture and the software (Compiler). There should be no one with an absolute advantage. It can only be said that there are different products to meet different needs. For example, a simple printer core MCU is suitable for using a RISC MCU with stable performance but better unit instruction efficiency. As for the processing method of single-chip microcomputer, there are two types of system structures of single-chip microcomputer at present: one is to use program and data memory separately, that is, Harvard structure, and most of the current single-chip microcomputers have this structure. The other is to use the principle similar to the Von Neumann of PC, and do not make a logical distinction between program and data memory, that is, Princeton structure. 67. In many cases, the measurement system with single-chip microcomputer as the main controller needs to maintain trouble-free operation for a long time, so its self-diagnosis becomes the key. Please introduce some knowledge about the fault self-diagnosis of single-chip microcomputer system? Answer: To ensure that the system can run for a long time without faults, it is very important to prevent interference. The most effective way is to remove the interference source and cut off the interference path, but it is often difficult to do so, so we can only see whether the single-chip microcomputer has strong enough anti-interference ability. The most common phenomenon of single-chip microcomputer interference is reset; as for the program running away, in fact, the software trap and watchdog can also be used to pull the program back to the reset state; so the most important thing for single-chip microcomputer software anti-interference is to handle the reset state well. Generally, microcontrollers have some flag registers that can be used to determine the reset reason. In addition, you can also bury some flags in RAM. Each time the program is reset, by judging these flags, you can determine different reset reasons; you can also jump directly to the corresponding program according to different flags. This makes the program run continuously, and the user will not notice that the program has been reset when using it. 68. The function of MCU can only be displayed after the program code is written into ROM. When testing MCU, it is done after writing the program into ROM and providing the corresponding test vector to the input pin. Then, for OTP type MCU, it can only be programmed once, so each time the finished product is tested after packaging, one is scrapped after testing. As far as I know, Holtek's MCUs are mostly OTP version microcontrollers. How does Holtek solve this testing problem? Answer: If you are a tester of an IC manufacturer, according to Holtek's experience, the test is divided into two steps. First, burn the code into the ROM of the bare chip to test whether the IC can write the program normally. If the test passes, use ultraviolet light to erase the ROM code of the bare chip and package it. Second, use an external test circuit to test the logic circuit of the packaged IC. If you get the packaged chip from the manufacturer and test it yourself for sale, then all you can do is measure the logic circuit of the IC by measuring parameters such as I/O port resistance and diode value. You cannot test whether the ROM code can be written correctly, unless the original designer of the IC knows how to test the IC's reserved Test Rom (if any). 69. As a tester for the IC manufacturer, do you test the entire wafer, or do you test each die after the wafer is cut into dies? Answer: The bare chip ROM code is burned using a needle pressure machine, so the entire wafer must be burned together, and a single die cannot be arranged neatly for burning. 70. "The bare chip ROM code is burned using a needle pressure machine, so the entire wafer must be burned together, and a single die cannot be arranged neatly for burning." Is the test at this stage only used to test the OTP itself, or is it written with targeted program code and the corresponding test vector applied to the input pin to test whether the function of the entire MCU is correct? Answer: At the wafer stage when the chip has not been divided, of course, DC test, Function test, etc. must be completed during testing. If it is an OTP type chip, the code burning work must also be solved. It is difficult to handle after cutting! The Probe Tester is actually divided into two parts. The Probe (needle pressure) is the mechanical part, which has the function of position alignment and chip array testing. The ports on the chip can be led out to the Tester at the back. The Tester is basically a special computer device. Different chips can be tested by writing different test programs.The function of MCU can only be shown after the program code is written into ROM. When testing MCU, the program is written into ROM and the corresponding test vector is provided to the input pin. Then, for OTP type MCU, it can only be programmed once, so each time the finished product is tested after packaging, one is scrapped after testing. As far as I know, most of Holtek's MCUs are OTP version microcontrollers. How does Holtek solve this testing problem? Answer: If you are a tester of an IC manufacturer, according to Holtek's experience, the test is divided into two steps. First, burn the code into the ROM of the bare chip to test whether the IC can write the program normally. If the test passes, use ultraviolet light to erase the ROM Code of the bare chip and package it. Second, use an external test circuit to test the logic circuit of the packaged IC. If you get the packaged chip from the manufacturer and test and sell it yourself, then all you can do is to measure the logic circuit of the IC by measuring the resistance of the I/O port, the diode value and other parameters. It is impossible to test whether the ROM code can be written correctly, unless you are the original designer of the IC and know how to test the Test Rom reserved by the IC (if any). 69. As a tester of IC manufacturer, do you test the whole wafer or each die after cutting the wafer into dies? Answer: The ROM code of bare chip is burned by needle pressure machine, so the whole wafer must be burned together, and the single die cannot be arranged neatly for burning. 70. "The ROM code of bare chip is burned by needle pressure machine, so the whole wafer must be burned together, and the single die cannot be arranged neatly for burning." Is the test at this stage only used to test OTP itself, or write targeted program code and apply corresponding test vectors to input pins to test whether the function of the whole MCU is correct? Answer: At the wafer stage when the chip has not been divided, of course, DC test, Function test, etc. must be completed during testing. If it is an OTP type chip, the code burning work must also be solved. It is difficult to handle after cutting! Probe Tester is actually divided into two parts. Probe (needle pressure) is the mechanical part, which has the function of position alignment and chip arrangement test. Each port on the chip can be led out to the tester at the back. The tester is basically a specially matched computer device that can test different chips by writing different test programs.The function of MCU can only be shown after the program code is written into ROM. When testing MCU, the program is written into ROM and the corresponding test vector is provided to the input pin. Then, for OTP type MCU, it can only be programmed once, so each time the finished product is tested after packaging, one is scrapped after testing. As far as I know, most of Holtek's MCUs are OTP version microcontrollers. How does Holtek solve this testing problem? Answer: If you are a tester of an IC manufacturer, according to Holtek's experience, the test is divided into two steps. First, burn the code into the ROM of the bare chip to test whether the IC can write the program normally. If the test passes, use ultraviolet light to erase the ROM Code of the bare chip and package it. Second, use an external test circuit to test the logic circuit of the packaged IC. If you get the packaged chip from the manufacturer and test and sell it yourself, then all you can do is to measure the logic circuit of the IC by measuring the resistance of the I/O port, the diode value and other parameters. It is impossible to test whether the ROM code can be written correctly, unless you are the original designer of the IC and know how to test the Test Rom reserved by the IC (if any). 69. As a tester of IC manufacturer, do you test the whole wafer or each die after cutting the wafer into dies? Answer: The ROM code of bare chip is burned by needle pressure machine, so the whole wafer must be burned together, and the single die cannot be arranged neatly for burning. 70. "The ROM code of bare chip is burned by needle pressure machine, so the whole wafer must be burned together, and the single die cannot be arranged neatly for burning." Is the test at this stage only used to test OTP itself, or write targeted program code and apply corresponding test vectors to input pins to test whether the function of the whole MCU is correct? Answer: At the wafer stage when the chip has not been divided, of course, DC test, Function test, etc. must be completed during testing. If it is an OTP type chip, the code burning work must also be solved. It is difficult to handle after cutting! Probe Tester is actually divided into two parts. Probe (needle pressure) is the mechanical part, which has the function of position alignment and chip arrangement test. Each port on the chip can be led out to the tester at the back. The tester is basically a specially matched computer device that can test different chips by writing different test programs.
91. In the design of single-chip microcomputer programming, how to force a return to the main program from a nested high-level interrupt? Can the subroutine return instruction be replaced by a jump instruction to return to the main program after restoring the stack? Answer: If it is a 51 series, the POP instruction can be used directly to achieve a forced return; if it is a RISC-structured single-chip microcomputer (HOLTEK single-chip microcomputer is a RISC structure), it is generally a hardware stack, without PUSH and POP instructions, so the subroutine call and return instructions must be used in pairs. 92. What are the requirements for the speed of the single-chip microcomputer? Can Holtek's single-chip microcomputer meet this application? Answer: At present, the maximum speed of HOLTEK's single-chip microcomputer is 8MHz, and the execution time of an instruction is 0.5us. At this speed, it can meet the development of most projects; I don’t know what specific project you are talking about. At present, HOLTEK microcontrollers mainly include OTP and Mask. In the future, Flash microcontrollers will be launched. However, HOLTEK's development system is very complete. During the development stage, HOLTEK can also provide free samples appropriately. Relatively speaking, the development cost is not higher than that of Flash. 93. PSoC is a flexible and powerful software and hardware embedded development system. Can PSoC replace part of the microcontroller system? Answer: In general embedded system applications, dozens or even more analog or digital peripheral components may be required. Engineers familiar with MCU development know that in the process of MCU development, the most time-consuming and energy-consuming thing is the selection of components and the consideration of component compatibility. There are thousands of different peripheral components on the market. It is a headache for designers to find components suitable for their applications. Therefore, the ideal solution for design engineers seems to be to use customized SoC chips, but if customized microcontrollers, ASICs and PLD devices are used, on the one hand, the price is relatively expensive, and on the other hand, designers need to have special design skills. Therefore, it is necessary to develop an 8-bit microcontroller with high efficiency, embedded and configurable peripheral components and low power consumption. PSoC (Programmable System on Chip) is a new generation of powerful 8-bit configurable embedded microcontroller recently launched by Cypress MicroSystems of the United States. The fundamental difference between this series of microcontrollers and traditional microcontrollers lies in the digital and analog block modules integrated inside. Engineers can call different digital and analog block modules according to different design requirements to complete the functional design inside the chip; use a chip to configure a microcontroller with a variety of different peripheral components, and establish a configurable embedded microcontroller; to achieve the whole process from determining the system function to software/hardware division and completing the design. Therefore, PSoC can adapt to very complex real-time control needs. Using it for product development can greatly improve development efficiency, reduce the complexity and cost of system development, and enhance the system's reliability and anti-interference ability; therefore, it is particularly suitable for various control and automation fields. Therefore, PSoC's dynamic configuration capability provides developers with a fast and convenient programming and development method, and also opens up a larger space for the application of microcontrollers. Therefore, the use of the flash memory integrated in the chip can reduce the product development cost and shorten the product development cycle. Therefore, this MCU structure has a broad prospect for application and promotion. 94. What initialization operations does the microcontroller perform on the modem? Answer: Generally, the MCU's MODEM communication must have two background knowledge, one is the AT command set, and the other is the universal asynchronous receiver transmitter (UART). l AT command set The following introduces the AT commands involved in my communication program example. Dn: Dial command. This command makes the MODEM immediately enter the off-hook state and dial the number that follows. The D command is a basic dialing command. It is modified by other commands to form operations such as when and how the MODEM dials. T: Audio dialing. For example, ATDT8886666, where 8886666 is the telephone number. P: Pulse dialing. For example, ATDP8886666, where 8886666 is the telephone number. ,: Standard pause. We often encounter the situation that we need to pause when dialing an external line, and wait until we hear the secondary dial tone (external line) before we can dial the subsequent number. The default pause time is 2s (seconds), which is specified by the S8 register. Sn: Indicates the register inside the MODEM. S0: Automatic response. If the MODEM is required to have the automatic response feature, the S0 register of the MODEM should be set to non-0 in advance. S8: Pause time of the comma dial modifier. This register determines the time the MODEM should pause when it encounters a comma (,) during dialing. l Universal Asynchronous Receiver Transmitter UART In-depth understanding of the internal structure of UART and the meaning of each bit of the internal register, and detailed understanding of the process of data transmission and reception, will help to write efficient and stable programs. Generally introduces the registers that need to be known when writing basic communication programs. The actual ADDRESS is determined by the specific wiring. l Serial transmission rate divisor latch (LSB, MSB) Some parameters must be initialized before communication, and the serial transmission rate is the first item that should be considered. This register is a 16-bit register, divided into the lower 8 bits (LSB) and the upper 8 bits (MSB) registers. In addition, the microcontroller accesses the serial transmission rate divisor latch LSB/MSB. The commonly used operating frequency is 1.8432MHz. This frequency divided by 16 is the clock frequency of the serial transmission rate, which is used to control the speed of sending and receiving data. The calculation formula for the serial transmission rate divisor latch value is given below: Serial transmission rate divisor latch value = operating frequency / (16 × expected serial transmission rate) = 1843200 / (16 × expected serial transmission rate) l Receive buffer register and transmit holding register (transmit and receive holding register) The microcontroller accesses the receive buffer register (RHR) for read operations and the transmit holding register (THR) for write operations. l Interrupt enable register (interrupt enable register) l FIFO control register (FIFO control register) Selection of data transmission and reception mode. Two commonly used modes: FIFO and DMA. There are two DMA modes: DMA Mode 0 and DMA Mode 1.The microcontroller I use is AT89C51. I have tried to use the pop instruction to force the interrupt to return. It can indeed return to the main program. The specific method is: first pop the address in the stack, then push the new address in the main program, and finally execute the RETI instruction to return to the address. If the pop instruction is executed, the jump instruction can be used directly without the RETI instruction to return to the main program, but it will not be able to respond again when the next interrupt comes. How to return to the main program from the nested high-priority interrupt program? Do you have to go through the lowest-level interrupt to return? If you return directly, can you still respond normally to the next interrupt? Answer: For the 51 series of microcontrollers, when the mid-level response occurs, the corresponding priority valid trigger will be set to position; when exiting the interrupt, RETI is executed, and the microcontroller automatically clears the priority valid trigger to 0. Therefore, if you use the jump instruction directly to come out of the interrupt subroutine, the microcontroller does not clear the priority valid trigger to 0, and it will not be able to respond when the next interrupt occurs. If you want to return to the main program from the high-priority interrupt program, you must execute two RETI instructions to clear the high/low priority valid triggers. The specific program can be: MOV DPTR, #LABLE1 POP ACC; pop the high priority subroutine return address POP ACC PUSH DPL; push the LABLE1 address to the stack PUSH DPH RETI LABLE1: POP ACC; pop the low priority subroutine return address POP ACC MOV DPTR, #LABEL2 PUSH DPL; push LABLE2, the main program address to be returned, to the stack PUSH DPH RETI