10194 views|11 replies

251

Posts

0

Resources
The OP
 

Microcontroller Application Programming Skills [Copy link]

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.

This post is from MCU

Latest reply

It’s so powerful!!!  Details Published on 2009-3-20 11:14
 

251

Posts

0

Resources
2
 
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.
This post is from MCU
 
 

251

Posts

0

Resources
3
 
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.
This post is from MCU
 
 
 

251

Posts

0

Resources
4
 
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.
This post is from MCU
 
 
 

251

Posts

0

Resources
5
 
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.
This post is from MCU
 
 
 

251

Posts

0

Resources
6
 
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.
This post is from MCU
 
 
 

251

Posts

0

Resources
7
 
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.
This post is from MCU
 
 
 

251

Posts

0

Resources
8
 
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.
This post is from MCU
 
 
 

251

Posts

0

Resources
9
 
71. 如何编写一个很好测试程序代码以达到较高的功能测试覆盖度? 答:应在芯片电路最初的设计及仿真阶段,就要规划好测试的方法,由于现今已经有很power的芯片设计和测试pattern工具,所以很快就能算出Test pattern coverage(测试覆盖率-电路logic的0/1toggle rate)是否合要求!至于测试MCU,应该是执行一些内建测试指令使所有电路都曾经toggle过即可,这和指令组合变化无关。 72. 如果封装对OTP产生了影响,导致芯片不能正常工作,而MCU的逻辑电路又是测试合格的,如何解决呢? 答:封装后,我们分三个步骤测试OTP。1、查空,看芯片内部ROM是否为空。2、写入一部分所需Code,验证是否ok。3、测试逻辑电路,一旦裸片被刮坏的话,静态电流就会变大。一旦这三个步骤测试OK,那么基本上OTP封装片就是合格的。 73. 在此以PIC16F87X为例:MCU处于sleep时,用WDT定时,如何使其在宽温度范围内工作定时相对一致,误差尽量小呢? 答:一般MCU处于sleep时,WDT(看门狗)是停止状态,用WDT的主要目的,是在程序运行当中,MCU受到外面杂讯干扰,导致程序运行乱掉或MCU当掉,此时就须WDT(一般WDT时钟来源是选用内部RC振荡)来自救及做复位动作,而当MCU处于sleep时,其MCU是处于省电模式状态,因主振停止所以程序不运行,此时就WDT可以停止动作(此模式WDT时钟来源是选用主晶振系统),如果MCU处于sleep时,又要WDT能继续动作,此时只有一个目的,就是用WDT的时间段来做定时工作(因程序停止运行,无法清除WDT计数器,故WDT计数一定会溢出),而在这个模式下因主振停止(因要省电)的WDT时钟来源只能选用内部RC振荡,所以RC振荡的频率会受工作温度及电压变动而产生飘移,所以要省电模式下不建议用WDT来做定时。 如果要省电模式下做定时工作,有一个很好建议,可采用HOLTEK MCU双振荡系列,如HT49XX,HT47XX,HT48XX,HT46R6X等系列,其优点在省电模式下,其主振停止而保持第二振荡系统维持振荡,此振荡系统为RTC(Real Time Clock 32768Hz振荡系统),工作电流维持在2~3uA(工作电压3V)之间,又因是用32768晶振,不受工作温度及电压变动的影响,可准确做定时工作。 74. 在开发一个需要长时间可靠运行的电子测量设备,有关单片机(DSP)系统的故障自诊断相关问题(包括主控制器,外围器件,如AD,RAM,ROM等)如何解决? 答:DSP是专门用在数字信号处理的晶片,与单片机相比DSP器件具有较高的集成度,而且具有更快的CPU,更大容量的记忆体,计算能力强大,运算速度快,能够满足系统的要求内置有串列传输速率发生器和FIFO缓冲器。提供高速,同步串口和标准非同步串口。有的片内集成了A/D和采样/保持电路,可提供PWM输出。DSP器件采用改进的哈佛结构,具有独立的程式和资料空间,允许同时存取程式和资料。内置高速的硬体乘法器,增强的多级流水线,使DSP器件具有高速的资料运算能力。DSP的计算能力虽然很强,但其事件管理能力较弱,而且直接支援的I/O口很少。为了方便地实现人机交互,采用DSP与单片机协同工作的方式:以单片机为主机,通过通讯介面对DSP实现控制;同时利用单片机较强的外围设备管理能力实现人机介面,显示等功能。主要工作流程是:弹簧的输入输出信号经过滤波电路进行调理后,由A/D转换器转换为数字信号,再进入DSP进行运算,得到的诊断结果通过通讯介面电路送入单片机,单片机将结果显示在液晶显示器上,并经过串口送入到其它应用介面。 因为DSP电路完成数据采集及数字滤波,软件的设计主要包括DSP编程和单片机编程。DSP程式的主要任务是初始化,管理DSP外围电路和完成,在故障自诊断方面,主控制器部份大都是利用内置的演算法完成故障诊断等任务, 单片机程式包括键盘控制程式,液晶驱动显示程式,与DSP及其它机器通信的程式。其它部份的故障自诊断,可参考本板开头说明部份来处理等。 75. 在电路上有一个温控开关串联在供电回路,正常情况电阻很小,温度升高后,电阻增加。这时cpu的工作电压大概在3。1v左右,好象是工作在复位状态,液晶不断闪烁,想在软件中这样判断:如果有连续5次上电复位,且每次间隔不超过100ms,就关闭所有功能。但是这样的话,cpu会一直工作在复位状态,会不会有问题? 答:也就是说,电压会在3。1V左右波动,而CPU的最低工作电压是在3。1V,所以会造成CPU一直复位。如果是这种情况,可能会造成CPU复位不正常。正常的上电复位是指电源电压从0V上升到VDD;掉电复位是指电源电压从VDD跌落到0V,后又恢复到VDD的过程;所以不管怎样,复位过程必须是电压从0V上升到VDD的过程。如果象所说的那样,电压从3。1V以上掉到3。1V以下,而又没有完全掉到0V,然后又上升,这样很容易造成CPU复位不完全而无法正常工作。 一般的解决方法是采用低电压复位电路,可以采用三极管复位电路,或采用低电压复位IC,如HOLTEK的HT70xx系列就是很好的低电压复位IC,可以到以下网址查阅到相关的资料:http://www.holtek.com.cn/products/power_4.htm 76. 比如用400减50,在程序语句上如何利用SUBB实现呢? 答:MCS-51单片机的指令系统中的减法指令只有一组带借位的减法指令(SUBB),而没有不带借位的减法指令。若要进行不带借位的减法操作,则需要在减法之前先用指令对进位C清零,具体指令:CLR C ,然后再相减。在进行多字节减法时首先应进行低字节的不带进位的减法,具体做法是先 CLR C,再用SUBB,而以后的高字节相减则都需要使用带进位的减法,直接使用SUBB指令即可。 77. 单片机系统为了省电,经常要进入掉电(POWER DOWN)状态,此时单片机的I/O口的PIN应设置为何种状态能获得最低功耗? 答:单片机I/O口可用作输入和输出状态。以HOLTEK一款最简单的I/O单片机HT48R05A-1为例,当作为输入时可设置成带上拉电阻的斯密特输入;作为输出时是CMOS输出。如果程序进入省电状态(HALT)时,首先,各个有用的I/O仍需输出一定值,以保证外部电路工作正常,同时请小心不要让外部电路保持长耗电状态(如长时间导通继电器);对于暂时不用的I/O口,为了节约功耗我们建议将I/O置为输出状态,并且输出为低。 78. 怎么样才能快速学会使用51系列和cygnal系列单片机? 答:建议购买一套ARM的开发学习板和仿真器(可以在网上查到适合自己的),结合教材在实践中学习ARM的基本开发方法。首先可以通过简单的程序编写熟悉ARM的指令集、体系结构、运行模式等基本原理,如果有一定的单片机知识基础,相信很快就能对此熟练掌握。接下来,因为32位ARM的应用大多会使用操作系统,所以此时可根据个人的计算机知识程度选择一个适合自己学习的嵌入式实时操作系统,多上机实作掌握嵌入式系统设计的基本方法,学习操作系统的应用程序的编程,并进一步掌握包含软硬件的基于ARM的系统应用开发。这一步需要具有高级语言的编程及操作系统知识,可能对非计算机专业的人员会有较大的难度,不过事在人为,相信只要有决心,难关总是可以被攻破的。另外,网上也有很多关于ARM开发的论坛,可以常上去下载相关的学习资料,请教高手,相互交流,相信会有所帮助。 79. 同样的功能实现,采用RISC和CISC内核的MCU,代码量哪个更大,即哪种需要更大的RAM以及ROM? 答:微处理随着微指令的复杂度可分为RISC及CISC这两类。下面先针对这两项做说明: 一、复杂指令集电脑CISC(Complex Instruction Set Computer) CISC是一种为了便于编程和提高记忆体访问效率的晶片设计体系。早期的电脑使用组合语言编程,由于记忆体速度慢且价格昂贵,使得CISC体系得到了用武之地。在20世纪90年代中期之前,大多数的微处理器都采用CISC体系──包括Intel的80x86和Motorola的68K系列等。 1.CISC体系的指令特征 使用微代码。指令集可以直接在微代码记忆体(比主记忆体的速度快很多)里执行,新设计的处理器,只需增加较少的电晶体就可以执行同样的指令集,也可以很快地编写新的指令集程式。 庞大的指令集:可以减少编程所需要的代码行数,减轻程式师的负担。高阶语言对应的指令集:包括双运算元格式、寄存器到寄存器、寄存器到记忆体以及记忆体到寄存器的指令。 2.CISC体系的优缺点 优点:能够有效缩短新指令的微代码设计时间,允许设计师实现CISC体系机器的向上相容。新的系统可以使用一个包含早期系统的指令超集合,也就可以使用较早电脑上使用的相同软体。另外微程式指令的格式与高阶语言相匹配,因而编译器并不一定要重新编写。 缺点:指令集以及晶片的设计比上一代产品更复杂,不同的指令,需要不同的时钟周期来完成,执行较慢的指令,将影响整台机器的执行效率。 二、精简指令集电脑RISC(Reduce Instruction Set Computer) RISC是为了提高处理器运行的速度而设计的晶片体系。它的关键技术在于流水线操作(Pipelining):在一个时钟周期里完成多条指令。而超流水线以及超标量技术已普遍在晶片设计中使用。RISC体系多用于非x86阵营高性能微处理器CPU,像HOLTEK MCU系列等。 1.RISC体系的指令特征 精简指令集:包含了简单、基本的指令,透过这些简单、基本的指令,就可以组合成复杂指令。 同样长度的指令:每条指令的长度都是相同的,可以在一个单独操作里完成。 单机器周期指令:大多数的指令都可以在一个机器周期里完成,并且允许处理器在同一时间内执行一系列的指令。 2.RISC体系的优缺点 优点:在使用相同的晶片技术和相同运行时钟下,RISC系统的运行速度将是CISC的2~4倍。由于RISC处理器的指令集是精简的,它的记忆体管理单元、浮点单元等都能设计在同一块晶片上。RISC处理器比相对应的CISC处理器设计更简单,所需要的时间将变得更短,并可以比CISC处理器应用更多先进的技术,开发更快的下一代处理器。 缺点:多指令的操作使得程式开发者必须小心地选用合适的编译器,而且编写的代码量会变得非常大。另外就是RISC体系的处理器需要更快记忆体,这通常都集成于处理器内部,就是L1 Cache(一级缓存)。 综合上面所述,若要再进一步比较CISC与RISC之差异,我们可以由以下几点来分析: 1、指令的形成 CISC因指令复杂,故采微指令码控制单元的设计,而RISC的指令90%是由硬体直接完成,只有10%的指令是由软体以组合的方式完成,因此指令执行时间上RISC较短,但RISC所须ROM空间相对的比较大,至于RAM使用大小应该与程序的应用比较有关系。 2、定址模式 CISC的需要较多的定址模式,而RISC只有少数的定址模式,因此CPU在计算记忆体有效位址时,CISC占用的汇流排周期较多。 3、指令的执行 CISC指令的格式长短不一,执行时的周期次数也不统一,而RISC结构刚好相反,故适合采用管线处理架构的设计,进而可以达到平均一周期完成一指令的方向努力。显然的,在设计上RISC较CISC简单,同时因为CISC的执行步骤过多,闲置的单元电路等待时间增长,不利于平行处理的设计,所以就效能而言RISC较CISC还是站了上风,但RISC因指令精简化后造成应用程式码变大,需要较大的程式记忆体空间,且存在指令种类较多等等的缺点。 80. 如何设计出具有照像、存储、输出、视频同步。本线路可接监视器,用为监视之用;在不拍照时,图像是时实的,在拍照的时候,在监视器的图像会停在那,显示所照的相片。照下来的照片可存储起来,要查看的时候可以调用。如何才能做到? 答:针对数位相机一些技术层面说明: 数位相机使用JPEG或MPEG-4影像压缩标准,其负责中枢的专用控制晶片组逐渐走向单晶片化,一般单晶片内含资料压缩与记忆体控制 。若从整个系统的控制方式来看,影响数位相机质量的参数包含:镜头,曝光装置,观景窗,瞻前萤幕、影像储存,Gamma修正,彩色平衡与修正,储存装置与编辑软体等,主要分为两大控制部份:其一是负责I/O介面,JPEG影像处理,资料压缩与储存,其二是负责处理所有自动光学处理功能如自动光圈(Auto Iris,简称AI)、自动聚焦(Auto Focus,简称AF),自动曝光(Auto Exposure,简称AE)与白平衡(White Balance)控制,过去这两大部份的控制系使用两颗微控制器(MCU)分别处理,目前已渐由单颗MPU或DSP另加一颗微控制器组成所取代。 经由光电转换元件CCD(或CMOS Sensor)将撷取到的物体所反射光的亮度、色彩与分布处理以后转换成数位信号,再将拍得图像存至数位相机的记忆体里。信号传递方式是类比R。G。B。信号自CCD转换成数位R。G。B。,整个过程中经信号放大、Gamma修正与白平衡修正才得以达成;数位R。G。B。资料再转换成亮度资料(Y)与两色差(Cr,Cb)。当影像资料进行压缩,压缩比若为1/4时图像资料所占的记忆容量就跟着降至1/4,例如记忆容量6Mbit的图像资料减至1。5Mbit,Y。Cr。Cb资料经再次取样重排后一个图框的数位资料记忆容量整个会降至3Mbit,其中Y占1。5Mbit, Cr、Cb两个合占1。5Mbit,整个转换过程不会影响垂直与水平的解析度,称为线的再次取样回复使用。 再论CCD(Charged Coupled Device)中文译为「电子耦合元件」,它就像传统相机的底片一样,是感应光线的装置,可以将它想像成一颗颗微小的感应粒子,铺满在光学镜头后方,当光线与影像从镜头透过、投射到CCD表面时,CCD就会产生电流,将感应到的内容转换成数位资料储存起来。CCD画素数目越多、单一画素尺寸越大,收集到的影像就会越清晰。因此,尽管CCD数目并不是决定影像品质的唯一重点,我们仍然可以把它当成相机等级的重要判准之一。 播放处理系经由记忆体读出所撷取之数位信号资料,透过解压缩电路及内插法处理转成PC或TV需要之信号。曝光控制,则由CCD(或CMOS)驱动电路里的Timing Generator来负责。
This post is from MCU
 
 
 

251

Posts

0

Resources
10
 
81. Holtek和AT系列编程有何不同,现有AT系列程序如何转为Holtek? 答:从指令集来看,ATMEL的AVR系列是8位RISC型的单片机,共有118条指令,而HOLTEK是63条指令,要将AVR的汇编程序转为HOLTEK的汇编需要熟悉两者的汇编指令将AVR的程序转译成HOLTEK汇编,而不能直接在HOLTEK芯片上使用,如果程序是用C编写,则大部分应该是可以直接使用的,但数据定义以及寄存器的定义可能需要改变;另外在编程的过程还需要考虑两者硬体结构的差异对指令实现功能的影响,有时候可能会因为硬体的不同,需要对项目进行重新的规划。 82. Holtek和AT系列有无FLASH可电擦写的型号? 答:目前HOLTEK没有FLASH可电擦写的型号,可以使用OTP芯片的DICE或者开窗片对EPROM进行紫外线擦除,实现对芯片的多次编程。 83. 在一个由MCU的产品中,开发完成,批量生产时,需要测试。然而,测试员可能不能测试到软件的每一处。在写程序时,做一个专门的测试流程,在某种条件满足时(比如几个键盘的同时按下),进入测试程序。测试程序中用一些比较短的时间来工作。如何实现? 答:以HOLTEK IC生产厂商的角度来看,对于一个MCU成品,一旦它的外围器件连接OK,它的MCU芯片基本逻辑功能运行正常,此MCU成品基本上就是良品了。因为IC在出厂前,都经过了逻辑、烧写测试,所以发给客户的封装片都是合格的。客户生产时所产生的不良片,大多数是I/O遭到破坏造成的(例如ESD破坏、高电压破坏),如果IC的I/O逻辑功能运行正常就说明此IC可以运行任何程序,并不需要测试到软件的每一处才能保证MCU成品的良率。因此您的测试方法已经可以保证IC的良率了。 84. 有没有很好的办法来解决加密问题但是又不破坏MCU的方法? 答:单片机系统产品的加密和解密技术永远是一个矛盾的统一体,针对科研成果保护是每一个科研人员最关心的事情,目的不使自己的辛苦劳动付注东流。对其单片机加密方法一般有采用软体加密,硬体加密,软硬体综合加密,时间加密,错误引导加密,专利保护等措施。有矛就有盾,有盾就有矛,有矛、有盾,才促进矛、盾质量水平的提高。而加密只讲盾的运用,以下就简单叙述加密的方法: 硬体加密:使他人不能读你的程式。 l 高电压或镭射烧断某条引脚,使其读不到内部程式,用高电压会造成一些器件损坏,即把单片机资料汇流排的特定I/O永久性地破坏,解密者即使擦除了加密位,也无法读出片内程式的正确代码。此外还有破坏EA引脚的方法。 l 重要 RAM 资料采用电池对RAM进行掉电资料保护。即先将一系列资料写入RAM并接上电池,然后将其余的晶片插上。这样,当单晶片微处理器系统运行后,CPU首先从RAM读出资料,这些资料可以是CPU执行程式的条件判别依据,也可以是CPU将要执行的程式。如果资料正确,整个系统正常运行。反之,系统不能运行。 l 汇流排乱置法。汇流排乱置法通常是将MCU和EPROM之间的资料线和位址线的顺序乱置。 软体加密:其目的是不让人读懂你的程式,不能修改程式,可以在程序重要资料区先用DES混码存放,但使用时须配合外面输入Decode码(金钥匙)来解编。或者是在无程式的空单元也加上程式机器码,最好要加巧妙一点等。 用真真假假方法加密:(1)擦除晶片标识。(2)DIP 封装改成 PLCC、TQFP、SOIC、BGA 等封装。 85. 在开发一个需要长时间可靠工作的控制系统(发电机系统),如何设计复位电路? 答:单片机复位可分为内部与外部事件复位。外部事件复位包括上电复位、RES复位和低电压复位。 上电复位和RES复位是人为的正常复位,以保证程序计数器被清零且程序从头开始执行。要正常进行这两种复位动作,需要外接正确的RES复位电路,一般来说不同的单片机的复位电路稍有不同,单片机厂商都会提供标准的复位电路资料。以HOLTEK IC为例,我们提供的复位电路是RES脚接100K欧姆的电阻至VDD;RES脚再接10K电阻和0。1uF的电容至VSS。 当电源电压受外部干扰,低于正常工作电压时,会造成程序功能运行不正常,严重的还可能造成单片机死机。此时发电机系统就会造成严重的后果,我们就需要用低电压复位来解决这个问题。通常我们可以用两个方法实现低电压复位:1、外加一个电压检测芯片(例如7033)加到RES脚上,当电源电压低于某个临界值时,电压检测芯片会给出一个低电平到RES脚是单片机复位,防止单片机死机。2、有些厂家的单片机内部会有一个低电压检测LVR的功能,例如HOLTEK单片机。当电源电压低于某一个临界值时,单片机会自动复位避免死机,外部不需要再连接任何检测电压的电路。 除了外部电源不稳定会造成单片机复位,内部WDT溢出也会造成复位,即内部事件复位。对于需要长时间稳定工作的系统来说,看门狗是十分必要的,它可以避免程序跑飞造成的错误。 当复位发生时,要保证复位后能与复位前的各个状态无缝的连接起来,就需要用软件来判定复位前程序执行到哪个程序段。以HOLTEK MCU为例,除了上电复位之外,通用寄存器复位前后的值不会发生变化。那么就可以设定一些寄存器记录程序当前运行在哪一个程序功能段。一旦发生复位,只需要读出那些寄存器的值就可以跳转到复位之前运行的程序功能段运行。另外HOLTE MCU内部有两个特殊标志位PD和TO,可以根据此两位的值来判定具体是什么原因造成的复位。 86. 从芯片封装及设计过程中增强芯片自身干扰能力的角度分析,有哪些好的抗干扰措施?封装过程中是否可以加屏蔽的技术,layout时可否采取措施?设计方面需要注意哪些问题? 答:一般在IC内部的抗干扰的处理方法,各家有各家的看家本领,例如在静电放电防护电路(ESD protection circuits)是积体电路上专门用来做静电放电防护之用,此静电放电防护电路提供了ESD电流路迳,以免ESD放电时电流流入IC内部电路而造成损伤。因ESD来自外界,所以ESD防护电路都是做在PAD的旁边。在输出PAD,其输出级中大尺寸的PMOS及NMOS元件本身便可当做ESD防护元件来用,但是其布局(layout)方式必须遵守Design Rules中有关ESD布局方面的规定。又例如传统的积体电路设计中,在电源、地的引出上通常将其安排在对称的两边。如左下角是地,右下角是电源。这使得电源杂讯穿过整个矽片。改进的技术将电源、地安排在两个相邻的引脚上,这样一方面降低了穿过整个矽片的电流,一方面使外部去耦电容在PCB设计上更容易安排,以降低系统杂讯。另一个在积体电路设计上降低杂讯的例子是驱动电路的设计。一些单片机提供若干个大电流的输出引脚,从几十毫安培到数百毫安培。 这些大功率的驱动电路集成到单片机内部无疑增加了噪音源。而跳变沿的软化技术可消除这方面的影响,办法是将一个大功率管做成若干个小管子的并联,再?每个管子输出端串上不同等效阻值的电阻,以降低di/dt。 87. 对于有WATCHDOG功能的单片机,如何去检查确认其是否起作用?比如说有的单片机要在程序执行HANGUP时,WATCHDOG才执行RESET,如何确认呢? 答:以HOLTEK最基本的I/O单片机HT48R05A-1为例说明。在单片机特殊寄存器STATUS中有PD和TO位,它们是可读不可写的。读取PD和TO的值,就可以判断出不同的复位原因,例如上电复位、正常工作下RES复位,HALT状态下RES复位、正常工作下WDT复位、以及HALT状态下WDT复位。因此只需要判断此两位的数值,就可以确认WDT是否起作用了。 如果需要WDT在HALT(即HANGUP)状态时发生复位动作,那么只需在正常工作时正确的喂狗(即CLR WDT),且看门狗的时钟来源选择内部RC时钟,当程序进入HALT状态后一旦WDT溢出会发生复位了。 88. 要研究一个将同步串口数据转换到以太网或USB的模块,能否推荐一个DSP或现在的高速单片机等,要能支持同步数据的DSP,同时这个DSP在连接REltek8139等网络芯片的开发又比较容易? 答:一般为网路多媒体应用来挑选一种DSP,是一件很复杂的工作。首先必须针对处理器的内核架构和周边配置进行全面的分析,理解多媒体资料流程(例如,视频、图像、音频和分组资料),如何在一个基于DSP的系统中传输十分重要,以便预防带宽瓶颈;另外,了解各种系统特性(包括DMA和记忆体存取)也很有帮助,这能使设计方案稳定可靠,而不只是勉强合格。 网路多媒体处理器的选择取决于一项设计对性能和连接性的要求。许多应用既需要MCU也需要DSP:MCU提供系统的控制功能,DSP完成密集的数值计算。对于这些截然不同的功能可以整合入单个处理器中,如HOLTEK HT82A88F系列DSP晶片。这种器件在单一架构内执行充分的控制功能和繁重的信号处理任务,同时还提供适合多媒体连接的各种周边介面。 系统工程师在选择DSP时首先应该分析的要素包括:1。每秒执行的指令数,2。每一处理器时钟周期内完成的运算元, 3。运算单元的效率。在待评估的DSP上运行一组有代表性的基准测试程式(如音频/视频压缩演算法),就可完成这些指标的评估。评判结果将指示出系统的即时处理要求是否超出了该DSP的能力,而且同样重要的是,该DSP是否有足够的性能去应对系统新增的或不断演变发展的需求。许多标准的基准测试程式假设待处理的资料已经驻留在DSP片内记忆体中。只要工程师协调好各I/O设计考虑,采用这种方法就能对不同厂家的DSP进行更直接的比较。 另外合适的周边埠组合,省去了支援所需介面的外部电路,而减少了开发时间及成本。网路多媒体设备(NMD)可带有各种各样的标准周边。这其中最重要的是与网路介面的连接。在有线应用中,乙太网(IEEE 802。3)是在局域网上实现联网的最普遍选择;而IEEE 802。11b/a正在成为实现无线局域网连接的首选方案。作为DSP的直接延伸,现在有许多乙太网解决方案可供选用。此外针对有很好地支援微处理器功能的DSP来说,也可用于直接管理TCP/IP堆叠。同步和非同步(UART) 序列埠也是连接DSP与多媒体系统环境所必需的。在网路多媒体设备系统中,音频编码资料一般通过8到32位的同步序列埠传输;而音/视频编解码控制通道则是通过更慢的串列介面来管理,如SPI或两线式介面。另外,UART支援RS-232数据机,也能支援用于近距离红外传输的IrDATM。 还有许多的DSP支援PCI或USB的通用介面,它能通过周边晶片桥接不同类型的设备,如PCI到IDE、USB到802。11b等。PCI还有提供一条单独内部汇流排的优点,这使得PCI汇流排主控器无需通过DSP内核或其他周边单元就能向DSP记忆体发送或读取资料。另外适于网路多媒体设备市场的DSP应包括一个外部记忆体介面,以便充当非同步和SDRAM记忆体控制器。非同步记忆体介面简化了与快闪记忆体、EEPROM和周边桥接晶片的连接,而SDRAM为针对大容量资料帧的高密度计算提供了其必需的存储空间。 89. HT48系列单片机支持串行通信吗?采用哪种通信方式较合适?HT46系列单片机串行通信的I/O口PA。67与51系列的RX/TX两PIN(P3。0/P3。1)的结构有何不同,传输效能是否一样?能给个键盘与电脑通信的例程和常规通信协议吗? 答:HT48系列的单片机支持串行通信。可以通过软件编程,利用HT48系列单片机的I/O实现串行通信。在HOLTEK的网站上有使用HT48系列进行“I2C”或者“三线串行通信”实现串行通信的软硬件应用范例(http://www.holtek.com.cn/tech/tech.htm)。 HT46系列的串行通信口PA。6/SDA和PA。7/SCL是共用管脚,它们可以通过掩膜选择作为普通I/O全双工的输出输入接口,或者串行通信口。当作为串行口时,SDA/SCL是I2C通讯总线协议的从端,这和51系列的RX/TX使用的串行通信协议是不同的,51系列的TX/RX遵循的是RS-232串行协议。所以他们之间的传输效能是不可比的。 如果想用单片机做键盘产品的话,推荐使用HOLTEK的HT82K68E,它支持PS/2接口,或者是HT82K96E,它支持USB接口。这些芯片是HOLTEK专为键盘应用所设计的。具体的芯片资料请见:http://www.holtek.com.cn/products/mcu_11.htm 90. 用一个12M的晶振,怎么能实现480MB/S的数据传输率呢? 答:在集成了PLL的12MHz的晶体振荡器即可达到480MHz,相位锁定回(环)路(Phase Locked Loop,PLL)又被称为相锁回路或锁相回路,其原理是经由闭回路自动控制系统的反馈作用,驱使另一个动作不精准、频率变动量高的作用元件的动作频率,使其能快速且一直保持稳定地与正确的频率参考源达到同相甚至是同相又同频的状态,如此即是相位锁定(Phase Locked)的状态,我们若以电路外部精准、频率变动量极低的振荡频率源作为基准参考,来驱使电路内部精准、频率变动量极低的振荡频率源,使其达成相位锁定的状态,即可用来作为通讯系统的调变/解调电路。 一般480MB/S的数据传输率是运用在USB 2.0,当通用序列汇流排(Universal Serial Bus)规格于1996年1月发表时,代表业界成功研发出一套连结中低速频宽的周边元件与个人电脑之间的低成本串连管道,但是仍缺乏支援高速宽频的应用能力。于2000年4月,USB再度推出全新一代的USB 2.0版本的技术规格,可将讯号传输速度提升整整40倍,由原先 USB 1。0的最高12MHz的速度至现今USB 2。0的高速480MHz,并扩增了更先进的功能,如新型的传输装置以提高频宽使用率与增加传输装置及主机控制器之间的附加功能。 针对实际上可供使用的频宽来说,资料的传输频宽速度由原先的1 Mbytes/sec左右提高至50 Mbytes/sec,这样一个大幅度的频宽增加主要归功于USB 2.0规格运用了微讯框(micro-frame)、可容纳更多资讯的传输封包、更频繁的传输次数、分割式传输处理(split transaction)、以及一些新的执照(token)等崭新技术。USB 2.0装置的架构同时增加了两项全新的描述元(descriptor),即装置认可(Device Qualifier)与其他的速度配置(Speed Configuration),可用来明确标示出资料传输装置在其它运作速度下的功能表现。 针对电子规格的变动:在主机与新型的高速控制器之间的连结则重新定义,以支援现今高达480MHz的传输效能表现。新的高速拓璞新的标准采用90W 的差分阻抗(differential characteristic impedance)搭配差分电流模式讯号(differential current mode signaling),并采用相同的NZRI编码机制(NZRI encoding),但对SYNC讯号(SYNC signaling)、EOP讯号(EOP signaling)与闲置状况(idle state)等略作更改,但也必须搭配其他相关规范,以便严格控制游离电容(stray capacitance)、点对点抖动(peak to peak jitter)与上升/下落时间(rise/fall time)等,使得讯号的传输速度能够更加快速。
This post is from MCU
 
 
 

251

Posts

0

Resources
11
 
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
This post is from MCU
 
 
 

31

Posts

0

Resources
12
 
It’s so powerful!!!
This post is from MCU
 
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list