1) Determine the task, complete the overall design
(1) Determine the design task and the system function index, write the design task book
In the early stages of microcontroller application system development, first of all, we must carefully investigate the research and study, in-depth understanding of all aspects of the user's technical requirements, understand the technical level of similar topics at home and abroad, conduct system analysis to find out the software and hardware design technical difficulties. The technical level of similar topics at home and abroad, system analysis, to find out the technical difficulties of software and hardware design. Then determine the tasks to be accomplished by the subject and should have the function, as well as to achieve the technical indicators. Comprehensive consideration of various factors to put forward the design of the preliminary program, the preparation of the design mission statement.
The design mission statement should not only clarify the system design tasks, but also to make provisions for the size of the system, such as the host model, extension model, equipped with which peripheral equipment, which is the basis for hardware design, cost. At the same time, it should also explain the indicators of the system parameters, operational specifications, which is the basis for software design.
(2) overall design
The overall design of the program should be formulated generally through careful research, demonstration, finalization, in order to avoid program negligence caused by software, hardware design to produce a large rework, delay the project development process, a general program of the key computing difficulties, should be set up for in-depth discussion of topics such as the selection of sensors. Sensors are often the key link in the test system, a well-designed measurement and control system, often due to sensor accuracy, non-linearity, temperature drift and other indicators of the limitations, resulting in the system does not meet the target requirements.
The overall design should be selected to determine the type and amount of system hardware, draw a general block diagram of the system hardware. One of the host circuit is the core of the system hardware, play based on the complexity of the system function, performance indicators, precision requirements, selected a performance-price ratio of the appropriate microcontroller model, while the need to select the peripheral expansion chip, human-machine interface circuit and configuration of external devices.
Input/output channel is an important part of the system hardware, the overall design should be based on the signal parameters, functional indicators require a reasonable choice of the number of channels, the structure of the channel, anti-jamming measures, drive capability, etc., to determine the input/output channel hardware types and quantities required. The selection of various types of hardware circuits, generally have to make a comprehensive comparison, these comparisons and choices must be completed on the basis of local tests.
The overall design should also complete the software design task analysis, drawing the total block diagram of the system software. Designers should also repeatedly weigh which functions are completed by the hardware, which tasks are completed by the software, software, hardware ratio to make reasonable arrangements.
Once the overall design is determined, the general size of the system, the basic framework of the software is determined. Then the system design tasks can be broken down into a number of topics according to functional modules, to draw up a detailed work plan, so that the back of the software, hardware design in parallel at the same time.
2) Hardware, software design and debugging U209B
(1) Hardware design
After the overall design, it enters the formal development stage. In order to make the hardware design as reasonable as possible, the following principles should be noted.
① Select typical circuits as far as possible, using hardware transplantation technology, and strive for hardware standardization and modularity.
② As far as possible, choose a new chip with strong functions to replace a number of ordinary chips, in order to simplify the hardware circuits, while with the new chip prices continue to decrease, the cost of the hardware system may also be Yuko declined.
③ System expansion and configuration should fully meet the functional requirements of the application system, and leave room for future system maintenance and upgrading.
④ As far as possible to soft instead of hard. Software and hardware are interchangeable, more hardware will not only increase the cost, but also increase the probability of system failure. The essence of the soft instead of hard is to time instead of space, it can be seen that this substitution is to reduce the real-time cost of the system. In the same way, the principle of considering soft instead of hard should be based on the premise of not affecting the performance of the system.
⑤ Reliability and anti-interference design. In order to ensure long-term reliable operation of the system, the hardware design must take corresponding reliability and anti-interference measures, including chip, device selection, decoupling filtering, reasonable wiring, channel isolation.
⑥ Must consider the drive capability. The load capacity of each I/O port of the microcontroller is limited, the external expansion should not exceed 70% of its total load capacity, if the expansion of the chip is more, it may result in overloading and unreliable system operation. At this point, line drivers should be considered.
⑦ Monitoring circuit design. Failure in the operation of the system, should be able to timely alarm, which requires the system has a self-diagnostic function, must be designed for the system monitoring circuit.
⑧ structural process design. Structural process design is an important part of the design of microcontroller application system, can be listed as a separate hardware design, software design outside the third design content, here it is in the hardware design to study. Structural process design includes system equipment modeling, shell structure, external dimensions, panel layout, module fixed connection, printed circuit boards, wiring and connectors. Requirements as far as possible to achieve standardization, normalization, modularity. General to the microcontroller as the core of the product, the microcontroller system are sufficient to internal, embedded, and the equipment itself is organically integrated, these products are required to be compact, beautiful and generous, friendly man-machine interface, easy to operate, install, debugging and maintenance.
In order to improve the quality of hardware design, speed up the development of speed, usually in the design of printed circuit boards, consider opening up a small piece of motorized wiring area. In the motorized wiring area, you can insert a number of pieces of integrated circuits sockets, and metallization holes, but no wiring. When the prototype development found in the hardware circuit has a significant lack of need to increase a number of components, can be in the motorized wiring area to complete the temporary pull line, thus avoiding major rework.
(2) software design
The design of the microcontroller application system focuses on software design, and the workload of software design is relatively large. First of all, the software general block diagram of each functional module specific, step by step to draw a detailed block diagram as the basis for software design.
Programming can use assembly language or a variety of high-level language. For the scale of the software is not written in assembly language, and for the more complex software, and computing tasks are heavier, you can consider the use of high-level language programming. c51, c96 cross-compiler software is more popular in recent years, a software development tool, which uses the c language to write the source program.
The software design should be as structured as possible using the design and modular programming methods, which is conducive to error checking, debugging, and adding and deleting programs. In order to improve reliability, software anti-interference measures should be implemented, programming must be optimized, carefully scrutinized, reasonably arranged, the use of a variety of programming skills, design a clear structure, easy to debug and transplantation, accounting for a small memory space, the execution of a short application time.
(3) bowl, software debugging
Microcontroller application system hardware, software development and debugging, because the microcontroller system itself does not have the ability to self-development, so it must be with the help of development tools - microcontroller development system. Through it can be easily programmed, compiled, debugged, run, simulation and other operations.
The performance of the microcontroller development system directly affects the level of application system design and development of work efficiency. Currently used more is the "general development system", by the general microcomputer system, online emulator, EPROM and EEPROM read/write parts, such as Figure 5.3 shows. In addition, there are "simple development system", "software simulation development system", "special development system" and so on.
Hardware debugging is carried out in the following two steps.
① Hardware circuit check. Hardware circuit check outside the microcontroller development system, available multimeter, logic pen and other conventional tools, check whether the circuit production is correct, to check the specifications of the components, models, check the correct chip-to-chip wiring, whether there is a short circuit, soldering and other faults, the power system should be carefully checked to prevent power short circuit, polarity error.
② Hardware diagnostic debugging. Hardware diagnostic debugging in the microcontroller development system, the microcontroller development system emulation head instead of the application system of the microcontroller, and then prepare some debugging programs, you can quickly troubleshooting to complete the hardware diagnostic debugging.
Whether the hardware circuits are operating normally can also be determined by measuring some important waveforms. For example, you can check the waveforms of several control signals of the microcontroller and expansion devices and the hardware manual to determine whether the specified indicators are consistent with the normal operation or not.
3) System general adjustment, performance measurement
After the system prototype assembly, must also be online general adjustment, to rule out the application of the system prototype in the software, hardware failure. In the general adjustment stage also biro must carry out system performance index test to determine whether to meet the design requirements, write a performance test report. The system prototype on-line general adjustment, test work after normal can be put into the field trial.
The last important work is the preparation of design documents, which is not only a summary of the development of microcontroller applications, but also the use of the system, maintenance, updating of important technical information documents. Design documents should include: design tasks and functional description; design program demonstration; performance testing and field use of the report; the use of operating instructions; hardware information: hardware logic diagrams, circuit schematics, component layout and wiring diagrams, connectors pin diagrams and printed circuit board diagrams; software information: software block diagrams and instructions, labeling and subroutine name lists, the list of parameter definitions, storage units and input/output port Address allocation table and program list.
With the progress of technology, microcontroller application system development can be used in the system programmable technology, that is, the use of JTAG interface to complete the system software design and debugging, just need a download line and a general-purpose PC and related software.