Any MCU, its basic principle and function are much the same, the difference is only the configuration and number of its peripheral functional modules, instruction system and so on. For the instruction system, although the form seems to be very different, but in fact only the symbol is different, the meaning it represents, the function to be completed and the addressing method are basically similar. Therefore, for any MCU, it should be understood and mastered from the following aspects:
< br \/ >
MCU characteristics and basic function analysis
< br \/ >
MCU features
To understand an MCU, the first thing you need to know is its ROM space, RAM space, the number of IO ports, the number of timers and timing methods, the Peripheral Circuit provided, the interrupt source, the operating voltage and power consumption.
< br \/ >
After understanding these MCU Features, the next step is to compare the features of the selected MCU with those required by the actual project development to identify which resources are currently required and which are not available for the project. For the functions needed in the project and the selected MCU does not provide, you need to carefully understand the relevant information of the MCU, in order to use indirect methods to achieve, for example, the development of the project needs to communicate with the PC COM port, and the selected MCU does not provide UART port, you can consider using external interrupt way to achieve;
< br \/ >
For the resources needed for project development, it is necessary to carefully understand and read their Manua*, while for the unnecessary functional modules, you can ignore or browse. For MCU learning, application is the key, but also the most important purpose.
< br \/ >
Once the relevant functions of the MCU are clear, programming can begin. For beginners or designers who use this MCU for the first time, there may be many unclear descriptions of the functions of the MCU. For such problems, there are two ways to solve them. One is to write a special verification program to understand the functions described in the data. The other can be temporarily ignored, the program design is written in accordance with their current understanding, left to debug to modify and improve. The former method is suitable for projects and beginners with relatively loose time, and the latter method is suitable for people with certain MCU development experience or the project schedule is more urgent.
< br \/ >
The instruction system should never take the time to understand. Instruction system is only a logical description of the symbol, only in programming according to their own logic and program logic requirements to view the relevant instructions, and with the progress of programming, the instruction system will become more and more skilled, and even unconsciously memorized.
< br \/ >
Basic functions of the MCU
For the vast majority of MCUS, the following features are the most common and the most basic, for different MCUS, the way they are described may be different, but in essence is basically the same:
TImer: Although there are more types of TImer, it can be summarized into two categories: one is the TImer with a fixed time interval, that is, the timing time is set by the system, the user program is not controlled, and the system only provides several fixed.