Outdoor Fishing Box,Storage Fishing Boxes,Multifunction Fishing Boxes,Fishing Tackle Seat Boxes Cixi Jinfeng Plastics Co.,Ltd , https://www.jftoolset.com
Mainly engaged in the development of machine tool numerical control system. Production and mechanical and electrical collection date: 2004-10 - integrated teaching. scientific research.
1 Mechanism and consequences of interference When the microcomputer is running in the industrial field, there are often many strong electric equipment in the workshop. Their start, stop and work processes will generate strong electromagnetic interference to the computer; the controlled object and the measured signal are often distributed. In different places, there is a long distance between the parts of the whole microcomputer control system, and the signal lines and control lines may be long lines. Therefore, electromagnetic interference is easily mixed into the application system from different ways.
The effect of interference on the microcomputer system can be divided into three parts: one is the input system, which causes the digital signal of the analog signal to be erroneous; the second is the output system, which makes the output signals confusing, resulting in a series of serious consequences; the third is the core of the microcomputer system. The digital signal on the three buses is confusing, causing a series of consequences. The CPU performs an arithmetic operation based on the erroneous data information, causing the result to be erroneous, and the error is passed down, resulting in a series of errors. After the CPU obtains the wrong address information, it causes the program counter PC to make an error, causing the program to fly away from the normal track, causing the program to run out of control or the control system to crash.
To deal with interference, there are both hardware measures and software measures. Hardware measures can keep most of the interference out, but there are still a few disturbances that break into the microcomputer system, causing control failure, damage to the transmission components, and even major accidents. Therefore, the software anti-jamming measures as the second line of defense are very important.
2CK-I lathe closed-loop control system software anti-jamming design CK-I lathe closed-loop control system, is a single-chip control system, its CPU is AT89C52. This system can be used for the control of two-axis machine tools. It is a hardware block diagram of the CIK-I type control system. 2.1 Digital signal input CK-I type control system needs to receive some external input signals, such as limit signal, tool change response signal, chuck clamping signal, spindle start and stop signal, etc. These signals are maintained for 200ns or even longer when passed to a microcomputer system. The interference signal is mostly burr-like and the action time is short. With this feature, a digital signal can be repeatedly acquired multiple times until it is completely consistent for several consecutive acquisitions. If the signal is always changing after multiple acquisitions, the acquisition can be stopped and an alarm signal is given.
The result of the storage unit is cleared. The total number of acquisitions is 10 times. The same number of times is cleared. The digital signal is collected. The result is stored in A. The result is sent to R2. The comparison is compared with the previous result. A0, not the same, skip. AR2; Acquisition is valid, send A 00H; different from last time, clear the same time; frequency to acquisition failure F0 = 0; delay (sampling interval); again collection in this example, the total number of acquisitions is 10 times, only continuous The data was collected the same three times, and the results were considered valid. In the program, CALLINPUT calls a digital signal acquisition program (for example, reads an input port of the 8255), and the 8-bit digital signal is collected and placed in the accumulator A. CALLDELAY calls a delay subroutine. The delay time can be set as needed. This delay can be inserted between acquisitions to deal with wide interference.
2.2 Digital signal output The output of the CK-I type lathe control system is digital signal, such as the control signal of the stepper motor, the drive signal of the electric tool holder, the start and stop signal of the spindle motor, and the clamping signal of the electric chuck. After the CPU gives the correct data output, external interference may cause the output device to get the wrong data. The result of such an error, if not taken to take effective measures to remedy, may have adverse consequences.
2.2.1 When the same design software is repeatedly output, the output process of the I/O chip can be arranged in the monitoring loop of the system, and the monitoring cycle period is short, which can effectively prevent the output device from malfunctioning. Note, however, that the output function is implemented as a complete module (such as a byte). When designing the software in this way, an 8-bit output buffer unit must be created for each I/O external device. The output function module outputs the data of all the temporary storage areas one by one, regardless of whether the data is just right or not. It was originally good.
When the output control of the stepping motor is performed, the control system uses a software algorithm to realize the function of the ring distributor. The computer directly outputs the energization state of each phase winding of the stepping motor, and after photoelectric isolation, is transmitted to the power amplifier. When programming the software, the method of repeated output can prevent the stepping motor from losing the step, and each phase can be repeated for 2~3 times.
2.2.2 The output chip is repeatedly initialized to function. The peripherals obtain the control information of the MCU through the 8255 chip. The 8255 chip should clarify the functions of each port during initialization. In order to ensure the correct output, the output function module should first execute the 8255 initialization command before executing the specific data output, that is, first write the working mode control word to the 8255, and then output the relevant data.
The same measures are taken for the 8279 chip that manages LED displays. Whenever the display subroutine is called to refresh the display, the 8279 is first initialized, the working mode is reset, and then the new display data is output. Each time the output is output, the output chip is initialized once, so that even if the output chip is disturbed, it can be restored to normal in a short period of time to avoid serious accidents.
2.3 CPU anti-jamming measures When the interference acts on the CPU itself, the CPU cannot execute the program in the normal state, which will cause confusion. The CK-I type control system uses the AT89C52 chip as the CPU. By executing the ORLPCON, 01 command, the CPU can enter the sleep state. At this time, only the timing/counting system and the interrupt system are in working state, and the CPU does not respond to the interference on the system three buses, which greatly reduces the sensitivity of the system to interference.
When the CKI system is working, an AC contactor is required to drive the spindle motor and the electric tool holder motor. Since the working current of the load is large and the starting current is larger, at the moment when the AC contactor operates, strong electromagnetic interference will be generated and transmitted to the CPU through various channels, so that the computer cannot work normally. Although the computer and the external connection signal have been optically isolated, when the oscilloscope is used to observe the ground and some signal lines of the computer power supply, it is still found that the interference signal is superimposed on it, and the duration is about 20ms. These interference signals often cause malfunctions such as control system failure, machine tool running, machine tool chaos or system crash, user program loss. In order to solve this problem, the RC arc-extinguishing capacity is added to both ends of the coil of the AC contactor, and the computer and the external connection line are replaced with shielded wires, but the electric tool holder starts to be indexed or the spindle motor suddenly starts and stops. At the same time, the above interference phenomenon still occurs. Finally, the CPU sleep anti-interference method is used to solve this problem. The specific idea of ​​CPU sleep anti-interference software design is as shown.
2.4 Recovery of key data The CKI type control system accepts the ISO code entered by the user from the operation panel, converts it into a HEX code, and sends it to the external data memory 62256 RAM for storage. Each time a block is sent, the last data byte in the 62256 storage address (herein referred to as STAD) is a key data. STAD needs to be protected when the system is powered down. To do this, it must also be written to the 62256RAM and a power-down protection circuit is created so that the data in the 62256RAM is not lost after the system is powered down. Although the power-down protection circuit is relatively reliable, the data in 62256 may still be destroyed at the moment of power-on or power-down, and STAD may be rewritten. Then, when the user re-enters the program, it is stored in 62256. The starting address of the stored data will change and the original program may be destroyed.
Once the address to be written becomes the output port address of the 8255 chip, the strobe signal of the stepping motor and the high-voltage turn-on signal of the driving power supply may be set to be effective, and the electric tool holder and the spindle may also rotate. It may cause an accident. Therefore, when the system is powered on, it is necessary to first check whether the STAD has been damaged. If it is damaged, the STAD should be restored as soon as possible before the data is written to 62256.
Each time the user enters a block, the editing software stores the last byte of the program data in the storage address of 62256 (which is a 16-bit address, which requires two bytes to be stored) and simultaneously sends it to the external RAM (00FAH) (00FFH). In the three groups of units, the critical data STAD is to establish triple backup data (data copies). The system restores the original value of STAD through the voting procedure each time the system is powered on for initialization. If two pairs of storage units are inconsistent, the voting fails; if two pairs of the three pairs of storage units are consistent, the voting is successful. The STAD triple backup is built in off-chip RAM because the off-chip RAM can only be modified by the MOVX instruction. In contrast, the data in the on-chip RAM can be modified by various MOV instructions, arithmetic instructions, logic instructions, and the security is poor. some. Before the voting, the three sets of data are respectively read from the external RAM into the working register (R2) (R7) in the CPU. After the voting is successful, the flow of the result into the (R2) voting program is as shown.
The source program list is as follows:; the first group is compared with the second group; the first group is compared with the third group; the second group is compared with the third group; the failure flag is set; the second group is subject to; the success flag is set; If the above vote is successful, STAD will be satisfied with the recovery.
3 Conclusion The software anti-interference method is simple and easy to use, and it is used on the CK-I type closed-loop control system, and the anti-interference effect is remarkable. The system passed the provincial appraisal and won the third prize of Anhui Science and Technology Progress Award. It has been put into production in batches, and more than 3,000 systems have been put into operation in the factory for ten years. Practice has proved that the software anti-interference method has certain promotion and application value.