Design and Application Scope of Intelligent Test System Based on Single Chip Microcomputer
“With the popularity of Electronic and electrical products in social life, many small and medium-sized enterprises in China have also begun to develop and produce such products to meet the needs of the market. However, due to the limitations of human and material resources of small and medium-sized enterprises, their main experience is often In the production of the product, the factory inspection of the product is not perfect, resulting in a high product repair rate. From the actual situation, a large part of the failures that cause repair can be found during the factory inspection. However, due to the fact that most of the domestic small and medium-sized enterprises rely on manual testing with the help of some instruments and meters, the testing efficiency is low and the testing area is not wide.
With the popularity of electronic and electrical products in social life, many small and medium-sized enterprises in China have also begun to develop and produce such products to meet the needs of the market. However, due to the limitations of human and material resources of small and medium-sized enterprises, their main experience is often In the production of the product, the factory inspection of the product is not perfect, resulting in a high product repair rate. From the actual situation, a large part of the failures that cause repair can be found during the factory inspection. However, because most of the domestic small and medium-sized enterprises rely on manual testing with the help of some instruments and meters, the detection efficiency is low, the testing area is not wide, and there are false detections and false detections.
The introduction of the intelligent test system can solve such contradictions well and help enterprises improve the efficiency of product testing. The following will take an intelligent test system of a mahjong machine motherboard as an example to comprehensively describe the design principle.
2, SST89E58RD2 features introduction
SST87E58RD2 is an 80C51 microcontroller, including 32KB+8KB FLASH and 256+768B data RAM. A typical feature of the SST89E58RD2 is its ×2 mode option, which allows designers to run applications at either the traditional 80C51 clock frequency (12 clocks per machine cycle) or the ×2 mode (6 clocks per machine cycle) clock) at the clock frequency.
The FLASH program memory supports traditional parallel programming as well as serial in-system programming (ISP). The ISP allows reprogramming of the device in the finished product under software control, and the SST89E58RD2 is also available with in-application programming (IAP), which allows reconfiguration of the two pieces of FLASH program memory at any time, even while the application is running.
The SST89E58CD2 features are as follows:
80C51 processing unit;
5V working voltage, operating frequency is 0-40MHz;
64KB of on-chip FLASH program memory, with ISP (in-system programming) and IAP (in-application programming) functions;
Support 12 clock (default) or 6 clock mode by software or ISP selection;
SPI (Serial Peripheral Interface) and Enhanced UART;
PCA (Programmable Counter Array) with PWM and capture/compare;
4 8-bit I/O ports (P0-P3), 1 4-bit I/O port (P4);
3 16-bit timers/counters;
Programmable Watchdog Timer (WDT);
10 interrupt sources, 4 interrupt priorities;
2 DPTR registers;
Low EMI mode (ALE disabled);
Compatible with TTL and CMOS logic levels;
Power down detection;
Low-power modes (power-down mode, wake-up from external interrupt, idle mode).
3. Principle of intelligent test system
This intelligent test system is based on SST89E58RD2, and its principle block diagram is shown in Figure 1, including:
The SPI port line is mainly used to program and communicate with the motherboard under test;
The I2C bus reads data to the external E2PROM in the motherboard under test;
RS232 circuit is used for communication with the host computer;
The external FLASH mainly stores the program object code of the motherboard under test, and selects AT29C010A;
Indicator light circuit, each fault point is indicated by an indicator light, there are 32 in total, and 4 pieces of 74HC595 are used as the output drive circuit;
The 2 step buttons are used for step control during the test process, and their control lines are directly connected to the P1.1 and P1.2 ports of the SST89E58RD2;
LED Display is used for test step display, controlled by 1 piece of 74HC595;
The DI input circuit uses 74HC165 logic chip, which is parallel in and serial out;
DO output circuit selects 74HC595 logic chip, serial input and parallel output;
Because there are many peripheral interface chips of the single-chip microcomputer, GAL16V8D is used as the control decoding circuit.
4. Intelligent test system function
The test object of the intelligent test system in this paper is the main board of the automatic mahjong machine. The design of the system is described below.
The main test items of the automatic mahjong machine include:
Main board power supply: 3 internal block power supplies; 12 9V AC DO signals, 16 DI signals; 4 power supply signals; 1 main power supply and 3 branch power supplies, 1 buzzer, 1 E2PROM with I2C; 1 SPI port is used to communicate and program with the intelligent test system.
The main board of the mahjong machine is AT89S52, which has the function of system programming (ISP) through the SPI port.
For these hardware functions of the main board of the mahjong machine, the intelligent test system has the following functional interfaces;
24 DO outputs are used to detect the DI signal of the motherboard under test;
16 AC/DC DI inputs are used to detect the DO signal of the motherboard under test;
An SPI bus interface is used for the program and communication of the motherboard under test;
An I2C interface is used to read and write the I2C E2PROM of the motherboard under test.
The test steps are as follows:
(1) Power test of the motherboard under test
The nominal value of the power supply is 5V, and the judgment condition is whether it is between 4.75-5.25V. It can be judged by a SHMILT comparator built by a N555, and the indicator light shows whether the result is normal. If the power test fails, the subsequent test steps will not be carried out, and the buzzer will prompt.
(2) SPI connection test and test procedure of the motherboard under test
Read the feature code of the CPU under test through the serial command of the SPI port, and judge that it is the AT89S52 chip (the type of single-chip microcomputer selected for the main board of the mahjong machine) through identification, that is, the motherboard under test is considered to be connected. For the SST89E58 MCU, its SPI port is a complete SPI port, but the SPI port of the AT89E52 MCU is used for the ISP function of FLASH. When the feature code is read correctly, it indicates that the SPI port is connected normally, and the system is tested at this time. Put the test program on the motherboard under test. The code of the test program is placed in the FLASH address of SST89E58RD2 in the space of 0X7000-0X7FF. After completion, the board test master can cooperate with the intelligent test system for testing.
(3) DI function test of the motherboard under test
Divide the 16-point DI of the motherboard under test into two groups, one group of 8 points, and connect them with the DO port line of the test system. After the DO signal is output by the test system and sampled by the motherboard under test, the sampled data is read back through the SPI port communication and compared. The similarities and differences between the output signal and the sampling signal, determine whether there is an abnormality in the channel, if there is an abnormality, it will be displayed by the fault indicator.
(4) DO function test of the motherboard under test
Divide the 12 DOs of the tested mainboard into 2 groups, 8-point group and 4-point group, connect to the DI port of the test system, communicate commands through the SPI port, let the tested mainboard output a specific state, and the test system samples through DI , compare the similarities and differences between the sampling data and the output characteristic data, and judge whether there is an abnormality in the channel. If there is an abnormality, it will be displayed by the fault indicator.
(5) Power-off data saving test of the motherboard under test
Because the tested motherboard also has a very important power-off data saving function, this function enables the CPU to store some characteristic data to the external E2PROM within a limited time after the power detection circuit inside the tested motherboard detects that the power is lost. (AT24C64). For this function, the test system will directly read the data inside the E2PROM through the I2C bus to determine whether the power-off data preservation is valid, and indicate through the indicator light.
(6) Check the fault indicator and complete the test
After the above 5 steps are completed, if there is no indicator light showing the fault, you can press the button to transfer the program of the main board of the mahjong machine to the AT89S52 to complete the whole test. If it is found that there is still a fault, press the back key to test again to confirm the fault.
5. The key program code of the intelligent test system
The intelligent test system implemented by this design has been applied to a manufacturer of automatic mahjong machines, and has achieved good application results. In the past, the factory inspection of the products of the factory used manual inspection mode. It took 20 minutes to complete the inspection, and the scope of inspection was limited to several main indicators; after the introduction of this intelligent inspection system, the inspection of the product can be completed in only 2 minutes. And the detection range covers most of the functions. When encountering products that cannot pass the detection, the fault source can be found quickly and accurately according to the prompts of the intelligent detection system, which greatly improves the production efficiency.
The intelligent test system can also be further developed:
(1) At present, many electronic products need to carry out live aging test before leaving the factory, but only live without load. If the intelligent test system is introduced into the aging test to simulate the workload of the product and make the product work at full load during the aging test, then Products that can pass the aging test will show more stable and reliable performance in practical applications.
(2) Electronic products need to be marked with the serial number and the version number of the product before leaving the factory. How to effectively control the entity of the product with the serial number and version number has always been a thorny problem for many manufacturers. If the intelligent test system is introduced into the factory The serial number and version number management of the product will also be very effective. By using the expansion function of the upper computer of the intelligent test system, it is connected to the computer through RS232. The intelligent test system has obtained the version number of the product before testing the product program. The factory serial number is calculated according to a series of attributes such as the date of the day and the factory order. When the product passes the test, the intelligent test system sends the serial number and version number to the upper computer, and the special software in the computer saves the serial number and version number. Enter the database and mark the serial number on the product.
At present, the intelligent test system implemented by this design is in the second phase of development. It is planned to introduce the intelligent test system into aging test and factory serial number management. After successful development, the performance of the system will be greatly improved and the scope of application of the system will be improved.