Since its entry into China for more than ten years, MCU has gradually applied to the practical application of engineering in various industries due to its small size, strong function, flexible expansion and convenient use. At present, most systems use the 51 series of 8-bit microcontrollers as the first choice, but in some more complex and high performance systems, you must give way to 16-bit microcontrollers. The MCS-96 series of 16-bit microcontrollers are especially suitable for various types of automatic control systems, such as AC and DC speed controllers, industrial process control systems, servo systems, etc. Taking the DC servo control system as an example, the structure of the system is introduced and the related algorithms are strengthened. It adopts a bipolar H-bridge, and uses a high-powered Guiliu rectifier bridge to rectify the AC into a DC. The voltage is regulated (incorporating a large-capacity capacitor) to provide the main power supply, and the IGBT in the IPM is used to form the H-bridge. Speed ​​control, Fujitsu's IPM technology is more mature, and has a variety of protection functions, only need to add a certain peripheral circuit to drive.
Main circuit principle box. 2 single-chip system system bit bus single-chip system, compared with MCS-51 series, this type of single-chip microcomputer improves the real-time performance of the system, mainly in: the arithmetic logic unit in the CPU does not use the conventional accumulator structure, use the register - The register structure, the operation of the CPU directly faces the 256-byte register, eliminating the accumulator bottleneck effect in the CPU structure, improving the operation speed and data throughput; in the 256-byte register, 24 bytes are dedicated registers, and the remaining 232 Bytes are general purpose registers. The number of general-purpose registers is much larger than the number of registers of the general CPU, so that special registers can be specified for local variables in each interrupt service routine, which eliminates the software overhead paid for protecting and restoring the field during the interrupt service process, and is greatly facilitated. Program design; 3-shaped generator (WG), which generates PWM waveforms without external ft components, while the waveform generator (WG) has flexible deadband adjustment. This is critical for practical PWM power amplifiers, which prevents four IGBT* common-state punch-throughs in a bipolar H-type main circuit. The so-called "common state punch-through" means that one IGBT in the bridge arm does not exit saturation and the other IGBT is turned on. The phenomenon of short circuit of power supply; 4 has a set of higher efficiency, faster execution instruction system, can use 20MHz clock, and newly added EPA (event processor array), PTS (peripheral transaction server), plus The 10-bit A/D converter is built in, which can quickly complete the conversion process of current and conversion to meet the dynamic response time requirements of the system.
Because the servo system current control regulator has a short sampling period and a large amount of calculation, the 80C196MC system uses a 16-bit system bus to improve the throughput of the system. The two EPROM 27C256 addresses are allocated as: 2000H~7FFFH; the two RAM62256 addresses are allocated as: A000H~FFFFH. Since the 16-bit address data bus is used, the two memories share the same address, and the specific connection is as follows: system address bus A. No, A , AEP connection with EPROM, RAM, A2 and A, connection, ... and so on, A15 is connected with A14. When the CPU reads the upper address of the memory, the high and low memory are selected at the same time, and the data of the upper 8 bits and the lower 8 bits are simultaneously read by the CPU. The CPU correctly selects the upper 8 bits of data as the operand, and discards the lower I bit of data. The same is true when reading the lower 8 bits. The chip select signal of RAM is composed of INST and eight 15 through NAND gate (1 river = 0' + person | 5), which should be noted that INST is low when reading program memory, but avoid 2000-2080 Address, because the INST pin is high when the interrupt vector is read. The system block diagram is as shown.
MCU system principle software system 3.1C program and assembly program collaborative development The difficulty of assembly language lies in data processing. Since assembly language does not directly support single-precision floating-point operations, and currently microcontroller development is becoming more complex, high-precision complex algorithms must be applied in many places. The C96 directly supports single-precision floating-point operations, which is sufficient for most applications and can be easily extended to double precision by algorithms. There are a large number of C programs available for the design of the algorithm, and there is basically no need to redevelop. Applying C96 to these modules can solve the problem as quickly as possible, and to accomplish the same function, the code generated by the C96 program compiled link is slightly longer than the code generated by the assembly. In situations where real-time response is required, developers often implement these modules in assembly code from the perspective of execution speed. According to the latest information, the efficiency of the new version of the C96 compiler can reach 1.1. In the MCU project, the input and output drive protection circuit reset circuit application C96, more importantly, the development cycle can be greatly shortened. In general, a senior programmer can complete a development task in less than half the time required by the assembler, and the execution speed of both will be twice the result with half the effort.
For example: Obviously, the program written by C96 has good readability and is convenient for future modification and maintenance. Most of the compilation is interpreted by annotations, and the personal annotation style is different, which will bring debugging work and future software upgrades. Difficulties have lengthened development time and manpower. When developing a project for a microcontroller, you often encounter problems with the mutual call between the assembly module and the C module.
(1) If no parameter transfer is involved, the ASMf...pseudo-instruction implementation (applicable to C96 and C51) can be used in the program, which is illustrated by the example of C96: (2) when the parameter is involved, in C language Take the main program as an example to illustrate an instance of mutual calling. (Applicable only to C51) Main program: However, in the AFUNC.A51 file, it is necessary to write according to the interface rules of C51 and assembly language to complete the corresponding functions.
NAMEA.FUNC; declare the function name; declare the external function code segment name PUBLICA-FUNC; external public symbol; can cover the local data segment X00:DS2; define the transfer parameter byte......: program code body END; AFUNC function ends, therefore, It is convenient to add the desired assembler to the body of the program code.
Finally, after all the programs are compiled and linked, you should carefully look at the generated M96 or M51 files, whether there is any overflow or conflict, and whether the data storage area and the program storage area are properly positioned. For the C196, the code segment and parameter segment of the C96 program can be set to be floating or absolute. When the C96 code segment and the parameter segment conflict with the assembler, a translation control option ram(...) of the RL196 is applied. Rom(...), romcode(...), romdata(...) to pinpoint code data segments to resolve conflicts.
For example, the above defines the code and constant data of module MOD2, MOD3 - FFFFH), the constant data of MODI is placed in the ROM of (4000-5FFFH). The value of the STACK stack segment should be set to the maximum available stack segment (using the STACKSEE control) based on the total memory RAM displayed in the last M96 file. The subroutine call of C96 should preferably not exceed three levels to avoid stack overflow. Practice has proved that these C96 programs and assembly language have achieved the true meaning (WGJ level, output PWM waveform. When WG-COUNT reset to 1, trigger a WG interrupt, CPU response WG interrupt, according to current loop new The value of WG-COMP, rewrite the value of WG-COMPx, change the duty cycle of the output waveform, and achieve the purpose of adjusting the motor speed. 4WG-CON: control, dead time register, determine the working mode and dead time of the WG .
One of the above-mentioned V-type PWM circuits, when one of the IGBTs does not exit saturation, the other IGBT starts to conduct again, which will cause a "common state conduction" phenomenon in which the power supply is directly short-circuited, which is an absolutely impossible failure. To avoid this phenomenon, the "seamless link".
3.2 Algorithm Improvement 3.2.1 Waveform Generator Working Principle Waveform Worker WG is the most characteristic peripheral of 80C196MC MCU, which plays a key role in PWM servo system. The WG of the 80C196MC can generate three-phase (three-way) sinusoidal PWM (SPWM) waveforms for variable frequency speed regulation of three-phase AC synchronous motors. The WG mode of operation in this case is called center alignment mode; it can also generate chopper voltage regulation. The PWM is used for DC motor voltage regulation, which is called setting the appropriate dead time, that is, when one IGBT is turned off, it experiences a dead time, and the other IGBT is then turned on, thus avoiding "common state conduction". "The phenomenon appears.
3.2.2 Algorithm Improvement Ideas In fact, not all calculations require the use of floating-point operations in the calculation of the speed and current loop. For the sake of simplicity, only the speed loop (current loop as a proportional link) is considered.
Because the speed encoder is used to sample the speed signal, the 80C196MC series of single-chip microcomputers can be edge-aligned by the phase shift counter.
Working in edge alignment, as shown, is the working waveform that does not take into account the effects of dead time. The relevant register meanings are: 1WG-RELOAD: reload register, determine carrier cycle; 21, 2, 3): phase comparison register, determine waveform duty cycle; 3WG-COUNT: bidirectional counter, WG time base (edge When aligning, it only counts up. The value of JG-COUNT is always compared with the value of WG-RELOAD. When the bit reaches 1, it starts counting again. At the same time, the value of WG-COUNT has been consistent with WG*COMP, the speed value of the time is obtained, and this value must be an integer, so the tracking accuracy of the speed actually depends on the accuracy of the speed encoder. When the r time takes a small time interval, the pulse number PL obtained in the time r can be used as the rotation speed value. In fact, the rotation speed at this time is: PL/r, and the time r is used as the speed loop control loop sampling period. When the given speed is also given in the integer value, as shown, since the output PWM period is constant (the value of WG*RELOAD is compared, when the value of WGCQUNT is equal to the value of WG+COMPx, the output pin is changed without considering the dead time. The edge alignment method of the working waveform speed loop block diagram is 100), the output comparison register 1 - (: 01 \ 51 can only be changed in the integer range, the input of the PI controller is the integer SP-GIV-EN * SP * N0W, the output is also an integer, so you only need to adjust the parameters of the PI to control the speed loop.
It is not difficult to prove that if the given speed is converted to the number of pulses in 71, the control effect is the same as the integer value. However, the PI parameter often appears as a floating-point number. In the debugging process, the value of the P and I parameters is determined by floating-point number calculation, and then the C96 assignment operator is used to assign an integer variable, thus fully utilizing the C96. The floating-point arithmetic library has refined the code and improves the operation speed. For the current loop, the P and I parameters of the current loop can also be determined according to the upper system program block diagram method and current control.
3.2.3 block diagram and.
4 system header file application of multiple models of chips, in the mid-1980s, INTEL company transferred the right to use the 8051 core to the world's many 1C manufacturers in the form of patent exchange or sale, such as Philips, Simens, Atmel, Lg Etc., these manufacturers have developed their own unique 51 series microcontrollers based on their own technology. Developers must customize the system header files of the microcontrollers they use to take full advantage of the capabilities of the various microcontrollers. The system header file (...h) actually defines the physical address corresponding to each terminal n and each function register. For the 51 series MCU, when the model of the MCU changes, you only need to convert the corresponding header file to realize the portability of the CM program. For the 96 series MCU, it is divided into teams, 0,! "(, 1, elbow 11, 10', it, financial and other models, different models correspond to different functions. Corresponding to different 96 chips, need to include different header files, in order to achieve the purpose of rapid development, and convenient for later Migration and redevelopment.
By separating the C96 program from the header file, it is also the charm of C96 program portability. These header files can also be provided by the developer or can be customized by yourself. For the 96MC series of microcontrollers, the following two headers are included: mc-sfrs.h (including the definition of each function register and port); me-flmc.h (including the definition of each special function function and the special structure Definition, such as the structural definition of the PTS interrupt vector).
5 Conclusions This paper takes the 80C196 single-chip microcomputer to form a constant-current servo control system as an example. It introduces its hardware structure and software programming method, and focuses on the collaborative development of C96 program and assembler, as well as some improvements to the algorithm. Physical system experiments show that this system has good speed regulation characteristics.
Anti-Aging Stitch Bond Fabeic,Effective Waterproof Stitch Bonded Fabrics,Reusable Stitch Bonded Fabrics,Shrink-Resistant Stitch Bonded Fabrics
yizheng jiayu textile products co.,ltd , https://www.jystitchbond.com