Microcomputer protection main program block diagram principle

The main program block diagram of microcomputer protection is shown in Figure 2-5.

 

    1. Initialization

"Initialization" refers to the program that the protection device first executes when powering on or pressing the reset button. It mainly sets the working mode and parameters of the single-chip microcomputer (CPU) and programmable expansion chip so that it can be used in subsequent programs. Work according to scheduled plan. For example, the settings of various address pointers of the CPU; the working modes and parameter settings of parallel, serial and timer programmable expansion chips. Initialization has three parts: initialization (1), initialization (2) and data acquisition system initialization.

Initialization (1) is to initialize the single-chip microcomputer and its expansion chip to initialize the switch output of the protection output and assign it to a normal value to ensure that none of the outlet relays operate. Initialization (1) is an initialization program that is required for both running and monitoring programs. After initialization (1), the main menu is displayed on the man-machine interface liquid crystal display, and the staff can choose the working mode of operation or debugging (exit operation). If you choose "exit running", you will enter the monitoring program, carry out an in-machine dialogue and execute debugging commands. If you choose "Run", start initialization (2). Initialization (2) includes procedures such as initializing the sampling timer, controlling the sampling interval, and clearing all software counters and various flag bits used during runtime in the RAM area.

After the initialization is complete, a comprehensive self-test of the protection device begins. If the device is abnormal, the device fault information will be displayed, and then the serial port interrupt will be opened, waiting for the management system CPU to query the self-test status through the serial port interrupt, and transmit the self-test results of each protection to the microcomputer monitoring system and dispatch. If the self-test of the device passes, the initialization of the data acquisition system is carried out. The initialization of this part mainly refers to the initialization of the sampling value storage address pointer. If it is a VFC sampling method, the programmable counter needs to be initialized. After completing the initialization of the sampling system, open the sampling timer interrupt and the serial port interrupt, wait for the interrupt to occur and transfer to the interrupt service routine.

2. Contents and methods of self-examination

After completing the initialization (2), enter the comprehensive self-test. Comprehensive self-test includes self-test of RAM, EPROM, EPROM and other circuits.

  • RAM read and write check

Write a number to a certain unit of RAM (for example, write AAH), then read it out, and compare whether the two are equal. If it is found that the written and read values ​​are inconsistent, it means that there is a problem with the random access memory RAM, and the driver display will display the fault signal (fault character code) and fault time, and the fault type will indicate "RAM fault". While displaying the fault, open the serial port interrupt and wait for the management unit CPU to query.

(2) Fixed value inspection

When each set of settings is stored in EPROM, several check codes are automatically solidified. If it is found that the read-only memory EPROM fixed value summation code is inconsistent with the pre-stored fixed value sum, it means that the EPROM is faulty, and the driver will display the fault character code and fault time, the fault type description "EPROM fault" and the fault range (setting area and sum) parameter area).

(3) EPROM summation self-test and CRC self-test

When summing and self-checking the EPROM, add the program code stored in the EPROM from the first byte to the last byte, and compare the summation result with the sum solidified at the end of the program. If it is found that the summing self-test is inconsistent with the summing result of the original program, the display will display the corresponding fault character, code, fault time and type description "EPROM fault". This summation self-inspection method has a simple algorithm and fast execution speed, and is often used in online real-time self-inspection of EPROM. However, EPROM accumulation and self-inspection are relatively more likely to be missed when multiple bytes are shifted. Therefore, the CRC cyclic redundancy code self-inspection method is often used for new production inspections. CRC self-test performs prescribed operations on each bit of each byte and has a high error detection rate. However, due to its slow execution speed and long CPU time, it cannot be used for online real-time self-test.

(4) Issue self-examination

The exit self-test mainly detects whether the exit channel is normal. It is detected through hardware exit feedback (see Chapter 1 Exit Trip Circuit for details).

3. Open interruption and waiting for interruption

At the time of initialization, the sampling interrupt and the serial port interrupt are still turned off by the soft switch of the CPU, at this time the A/D conversion and serial port communication are all in a prohibited state. After initialization, the analog-to-digital conversion should be started before entering operation, and a series of sampling calculations should be performed. Therefore, the sampling interrupt must be opened, the sampling timer starts counting, and a sampling interrupt request signal is sent every T time. In the same way, the serial port interrupt should be opened before entering operation to ensure the normal communication between the interface CPU and the protection CPU. After the open interrupt must be delayed 60ms to ensure the integrity and correctness of the sampled data.

4. Self-check cycle

After opening the interrupt, all preparations are ready, and the main program enters the self-test cycle stage. The fault handling program ends and returns to the main program, where it also enters the self-test loop.

The self-test cycle includes querying test reports, special and general self-tests, etc.

When the comprehensive self-test, special self-test and fault handling program return to the main program, there will be self-test information and protection action information. It is necessary to print out this information for the personnel on duty to view and save. Therefore, the query test report program is arranged at the beginning of the self-test cycle.

The general self-test content usually includes fixed value selection dial number monitoring and input quantity monitoring. The dial number for setting value selection is related to whether the protection setting value is normal. It must be detected and monitored. Once there is a change or poor contact, a call signal will be sent. The status of the input quantity involves the system operation mode, so it must be checked frequently. The CPU pre-reads the status of each input quantity and stores it in RAM, and then continuously reads the status of the input quantity to monitor whether there are changes. If there are changes, it will send out a call signal after a delay. In addition to the call signal light being on, the CPU will also Print a report, showing the input change time and the status before and after the change. The content of the dedicated self-test is to arrange different self-test contents according to different protections. It is mainly based on the protection requirements, such as detection 3 and 3, to determine whether the TA and TV are disconnected, and to determine whether the system stability is damaged, etc.

Constantly wait for the sampling interrupt of the sampling timer and the interrupt request signal of the serial port communication in the loop process. When the protection CPU receives the request interrupt signal, after enabling the interrupt, the program enters the interrupt service routine. Whenever the interrupt service routine is over, it returns to the self-test cycle and continues to wait for the interrupt request signal. The main program repeats self-inspection, interrupts and enters the continuous cycle stage, which is an important part of the protection program.

Finally, it should be pointed out that the main programs, interrupt service programs, protection logic programs and fault handling programs of various protection devices cannot be exactly the same. The various programs and their block diagrams described in this chapter can only be in a typical format.

Guess you like

Origin blog.csdn.net/weixin_42937161/article/details/131381312