Research and Application of Microcontroller Technology in Electric Drive Control System

Since its introduction into China for more than ten years, the SCM has been gradually applied to engineering applications in various industries due to its small size, strong functions, flexible expansion, and ease of use. At present, most systems use the 51 series of 8-bit microcontrollers as the first choice, but in some of the more complex and high-performance systems, they must be located in the 16-bit microcontroller. MCS-96 series of 16-bit microcontroller is especially suitable for all types of automatic control systems, such as AC and DC speed control, industrial process control systems, servo systems. Taking the constant current servo control system as an example, the structure of the system is introduced and the relevant algorithms are strengthened. It adopts bipolar H-bridge and uses high-power Gui tube rectifier bridge to rectify AC into DC. It adopts voltage regulation method (incorporates large-capacity capacitor) to provide main power, and IGBT in IPM constitutes H-bridge, using PWM. Speed ​​regulation, of which Fujitsu's IPM technology is more mature, and has a variety of protection features, just add a certain number of peripheral circuits can be driven.

Main circuit principle box. 2 SCM system bit bus microcontroller system, compared with the MCS-51 series, this type of single-chip microcomputer to improve the real-time system, mainly in: CPU in the arithmetic logic unit does not use the conventional accumulator structure, use the register - The register structure, the CPU's operation directly facing the 256-byte register, eliminates the accumulator bottleneck effect in the CPU structure, and improves the operating speed and data throughput capacity; in the 256-byte register, 24 bytes are dedicated registers, and the rest 232 The bytes are general-purpose registers. The number of general-purpose registers is much more than the number of registers of the general CPU, so that special registers can be assigned to local variables in each interrupt service program, which saves the software overheads that are paid and protected at the scene during interrupt service, and is greatly facilitated. Program design; 3-shaped generator (WG), PWM waveform can be generated without external ft components, and the waveform generator (WG) has flexible dead-zone adjustment. This is critical for practical PWM power amplifiers that prevent the common-state punch-through of the four IGBTs* of the bipolar H-type main circuit. "So-called common-mode punch-through" means that one IGBT in the bridge does not saturate and the other IGBT is turned on. The formation of a power short circuit phenomenon; 4 has a set of higher efficiency, faster execution of the instruction system, can use 20MHz clock, and a new addition of EPA (event processor array), PTS (peripheral transaction server), plus With its 10-bit A/D converter, it 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. Two EPROM 27C256 addresses are allocated as: 2000H~7FFFH; 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 connections are as follows: System address bus A. No, A , A. connection with EPROM, RAM, A2 and A, connection, ... and so on, A15 and A14 are connected. When the CPU reads the high memory address, it selects the high and low memory at the same time. The high 8 bits and low 8 bits data read the CPU at the same time. The CPU correctly selects the high 8 bits as the operand and discards the low I bit data. The same is true when reading the lower 8 bits. The chip select signal of RAM is formed by the INST and the eighty-five through NAND gates (1 river = 0' + person | 5). It should be noted that the INST is low when reading the program memory, but should avoid 2000-2080. The address, because the INST pin is high when reading the interrupt vector. The system block diagram is as shown.

MCU System Principles Software System 3.1C Program and Assembler Cooperative Development The difficulty of assembly language lies in data processing. Since assembly language does not directly support single-precision floating-point operations, the development of single-chip microcomputers has become increasingly complex. In many places, high-precision complex algorithms must be applied. C96 directly supports single-precision floating-point operations, which is sufficient for most applications and can be easily extended to double precision through algorithms. The design of the algorithm has a large number of C programs available for selection, and basically do not need to be re-developed. Applying C96 in these modules can solve the problem as soon as possible, and to accomplish the same function, the code generated by the compiled connection of the C96 program 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 single-chip microcomputer project, input and output drive protection circuit reset circuit applies C96, and more importantly, the development cycle can be greatly shortened. In general, a veteran programmer can complete the development task as long as he spends less than half of the assembly programmer, and the execution speed of the two programs will be a multiplier.

For example: Obviously, the program written in C96 has good readability, and is easy to modify and maintain in the future. Most of the compilation will be explained by comments, and the style of personal notes will be different, which will bring debugging work and future software upgrades. The difficulties have lengthened development time and manpower investment. When developing a project for a microcontroller, it is often the case that the assembly module and the C module call each other.

(1) If parameter transfer is not involved, it can be implemented by embedding the ASMf... pseudo-instruction in the program (applicable to C96 and C51) and illustrated by the instance of C96: (2) When it comes to parameter passing, in C language Take the main program as an example to illustrate an example of mutual calling. (Applies to C51 only) Main program: In the AFUNC.A51 file, however, it is necessary to write in accordance with the interface rules of C51 and assembly language to complete the corresponding functions.

NAMEA.FUNC; declares the function name; declares the external function code segment name publica-fUNC; external public symbols; can override the local data segment X00:DS2; defines the passing parameter byte ...: program code body END; AFUNC function ends so that It is convenient to add the desired assembler to the program code body.

Finally, after all the programs have been compiled and linked, the generated M96 or M51 files should be carefully checked for 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 floating or absolute positioning. When the C96 code segment and parameter segment conflict with the assembler, a translation control option ram(...) of the RL196 is used. Rom(...), romcode(...), romdata(...) to locate the code data segment to resolve conflicts.

For example: The above defines the module MOD2 code and constant data, MOD3 - FFFFH), MODI constant data (4000 - 5FFFH) ROM. The value of the STACK stack segment should be set to the maximum available stack segment (using the STACKSEE control entry) based on the total memory RAM occupied by the last M96 file. The C96 subroutine call should preferably not exceed three levels to avoid stack overflow. Practice has proved that these C96 programs and assembly language do the real sense (WGJ level, the output PWM waveform. When WG-COUNT reset to 1, a WG interrupt is triggered, the CPU responds to the WG interrupt, according to the current loop calculation The value of WG-COMP, rewrites the value of WG-COMPx, changes the duty cycle of the output waveform, and achieves the purpose of adjusting the motor speed.4 WG-CON: Control, Dead Time Register, Determines the WG Operating Mode and Dead Time .

In one bridge arm of the above-mentioned V-type PWM circuit, when one of the IGBTs does not quit saturation, the other IGBT starts to conduct again, causing a "common-state conduction" phenomenon in which the power supply directly short-circuits. This is an absolutely impossible failure. To avoid the occurrence of this phenomenon, "seamless links".

3.2 Algorithm Improvements 3.2.1 Waveform Generator Operation The waveform worker WG is the most unique peripheral of the 80C196MC microcontroller and plays a key role in the PWM servo system. 80C196MC WG can generate three-phase (three-way) sinusoidal PWM (SPWM) waveforms for frequency control of three-phase AC synchronous motors. In this case, the WG working mode is called center alignment mode; chopper regulation can also be generated. The PWM is used to regulate the speed of the DC motor. It is said to set a suitable dead time, that is, when one IGBT is turned off, it experiences a dead time and the other IGBT is turned on, thus avoiding the "common-state conduction". "The phenomenon appears.

3.2.2 Algorithm Improvement Ideas In fact, not all computations in the calculation of the speed and current loop require the use of floating-point arithmetic. For the sake of simplicity, only the speed loop is considered (the current loop is a proportional link).

Because the rotational speed encoder is used to sample the rotational speed signal, the 80C196MC series single-chip microcomputer can use the phase shift counter as the edge alignment method.

Work in the edge alignment mode, as shown in the working waveform without considering the impact of dead time. The related register meanings are: 1WG-RELOAD: reload register to determine carrier period; 21, 2, and 3): phase compare register to determine waveform duty cycle; 3WG-COUNT: double-direction counter, to be time base of WG (edge When aligned, only count up.) The value of JG-COUNT is always compared with the value of WG-RELOAD. When it reaches 1, it starts counting again. At the same time, the value of WG-COUNT is always with WG*COMP, and the speed value within 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 within the time r can be used as the rotation speed value. Actually, the rotation speed is: PL/r, and the time r is used as the sampling cycle of the speed loop control loop. When the given speed is also given as an integer value, as shown, since the output PWM period is constant (when 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 regardless of the dead time. The edge alignment mode of the working waveform speed ring is shown in the block diagram as 100). The output compare register 1―(:01\51 can only be changed in the integer range, and the input of the PI controller is integer SP-GIV-EN*SP*. N0W, the output is also an integer, so only adjust the PI parameters to achieve the control of the speed ring.

It is not difficult to prove that the given speed is the same as the integer value if it is converted to the number of pulses in 71 is not an integer. However, PI parameters often appear in the form of floating-point numbers. In the debugging process, the values ​​of P and I parameters are first set by floating-point calculations, and then an integer variable is assigned by the C96 assignment operator. This not only makes full use of C96's The floating-point arithmetic library also refined the code and improved the speed of operation. For the current loop, the P and I parameters of the current loop can also be determined according to the above system program block diagram method and current control can be performed.

3.2.3 Block Diagram and.

4 Application of system header files Multiple types of chips. In the mid-80s, INTEL Corporation transferred the right to use 8051 cores to many world-famous 1C manufacturers such as Philips, Simens, Atmel, and Lg in the form of patent swaps or sales. And so on, these manufacturers in their own 'technology based on the development of their own unique 51 series microcontroller. The developer must customize the system header file of the microcontroller used to give full play to the functions of various microcontrollers. The system header file (...h) actually defines the physical address corresponding to each end n and each function register. For 51 series single-chip microcomputer, when the model of the one-chip computer changes, only need to change the corresponding head file, can realize transplantability of CM procedure, likewise to 96 series one-chip computers, divide into teams, 0,! "(1, elbow 11, 10', it, money and other models, different models corresponding to different functions. Corresponding to the different 96 chips, need to include different header files, in order to achieve the purpose of rapid development, and can be convenient later Transplant and redevelopment.

By separating the C96 program from the header file, it is also the charm of the C96 program portability. These header files can also be provided by the developer, or they can be customized by themselves. For the 96MC series of MCU mainly includes the following two head yak: mc-sfrs.h (including the definition of the various function registers, ports); me a flmc.h (contains the definition and special structure of the special function functions Definitions, such as the structure definition of the PTS interrupt vector).

5 conclusions This article takes the 80C196 single-chip computer constitutes the direct current servo control system as an example, introduced its hardware structure and the software programming method, especially discussed the collaborative development of the C96 program and the assembler program, as well as some improvements to the algorithm. Physical system experiments show that this system has good speed regulation characteristics.

Plastic Faucet

Plastic Faucet,Plastic Water Tap,Dispenser Faucets Water,Plastic Pp Water Tap

Cixi Ruisheng Electric Appliance Factory , https://www.rswatertap.com