Product automatic test system manufactured based on C52 single-chip microcomputer

An automated testing system, cascaded with a C52 microcontroller, a selection trigger circuit, and a shift register, solves the customization and stability issues of small and medium-sized manufacturing enterprises, enabling rapid and accurate product testing and improving production efficiency and testing accuracy.

CN223742995UActive Publication Date: 2025-12-30DONGGUAN LONGJOIN ELECTRONICS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202520301288.X
Authority / Receiving Office
CN · China
Patent Type
Utility models(China)
Current Assignee / Owner
Filing Date
2025-02-25
Publication Date
2025-12-30
Estimated Expiration
2035-02-25

AI Technical Summary

Technical Problem

Existing automated testing systems are difficult to customize, deploy, and maintain for small and medium-sized manufacturing enterprises. They also lack stability under high load and long-term operation, and cannot adapt to production lines of different sizes and requirements.

Method used

An automated product testing system based on the C52 microcontroller is adopted. By combining the STC89C52RC microcontroller with a selection trigger circuit, an LCD display circuit, a power supply circuit, and a USB to serial port circuit, and using a cascaded multiplexer 74HC154D and a shift register 74HC595D, the system controls multiple relays. Combined with RS232 serial communication, the system achieves automated product testing.

Benefits of technology

It enables rapid and accurate product testing, reduces human resource input, improves production efficiency and testing accuracy, lowers labor costs, and adapts to the needs of production lines of different sizes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN223742995U_ABST
    Figure CN223742995U_ABST
Patent Text Reader

Abstract

The utility model relates to an automatic product test system manufactured based on a C52 single-chip microcomputer, which comprises a single-chip microcomputer, the single-chip microcomputer is connected with a selection trigger circuit, an LCD display circuit, a power supply circuit, a reset circuit and a USB-to-serial port circuit, and the USB-to-serial port circuit is connected with a computer through a USB. The selection trigger circuit comprises a demultiplexer connected with an I / O port of the single-chip microcomputer and a plurality of shift registers connected with the single-chip microcomputer and the demultiplexer, the shift registers are cascaded on the demultiplexer, and the output end of each shift register is connected with an output peripheral. According to the utility model, automatic testing of products is realized, rapid and accurate testing of the products is carried out, a large number of testing tasks are completed in a short time, human resource investment and testing period are reduced, delivery speed of the products is accelerated, testing precision and consistency are improved, labor cost is reduced, manual operation and human resource investment are reduced, and production efficiency is improved. The production efficiency and the economic benefit are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This patent application belongs to the field of automatic testing technology, and more specifically, relates to an automatic product testing system based on a C52 microcontroller. Background Technology

[0002] With the development of the manufacturing industry, automated production testing is widely used on industrial production lines. Automated testing systems enable rapid, efficient, and accurate testing of products, improving production line efficiency and quality. The continuous development of measurement and control equipment technologies, such as sensors, instruments, and data acquisition systems, provides more possibilities and solutions for automated production testing. Furthermore, the cost of automated testing equipment is gradually decreasing, leading more and more manufacturing companies to configure and use automated testing equipment to improve product quality and production efficiency.

[0003] Currently, with the increasing demand for product diversification and personalization, automated testing systems are placing greater emphasis on customization and flexibility. In particular, the need for customized, easily deployable, and maintainable automated testing solutions for small and medium-sized manufacturing enterprises will continue to grow. Furthermore, automated testing systems require high reliability, maintaining stability under high loads and long operating times. Simultaneously, the system should be scalable, adaptable to production lines of different sizes and requirements.

[0004] In summary, while automated production testing is widely used, it also faces development opportunities and challenges in areas such as intelligentization, data analysis, and customization. With technological advancements and social development, the prospects for automated production testing are very broad, bringing more efficient and higher-quality production and competitive advantages to the manufacturing industry. Utility Model Content

[0005] The technical problem to be solved by this utility model is to provide an automatic product testing system based on C52 microcontroller to realize automated product testing.

[0006] To solve the above problems, the technical solution adopted by this utility model is as follows:

[0007] An automatic product testing system based on a C52 microcontroller includes a microcontroller STC89C52RC. The STC89C52RC is connected to a selection trigger circuit, an LCD display circuit, a power supply circuit, a reset circuit, and a USB-to-serial port circuit. The USB-to-serial port circuit is connected to a computer via USB.

[0008] The selection trigger circuit includes a 74HC154D multiplexer connected to the I / O pins of the STC89C52RC microcontroller, and a 74HC595D shift register connected to both the STC89C52RC microcontroller and the 74HC154D multiplexer. There are multiple 74HC595D shift registers connected to the 74HC154D multiplexer in a cascade manner. The output of each 74HC595D shift register is connected to a relay and / or a controlled device.

[0009] The four I / O pins P1.4, P1.5, P1.6, and P1.7 of the STC89C52RC microcontroller are connected to the A0, A1, A2, and A3 pins of the 74HC154D. The VCC pin of the 74HC154D is connected to a 5V power supply, and the E0 and E1 enable pins of the 74HC154D are connected to GND. The Y0-Y15 pins of the 74HC154D are used as output pins.

[0010] The SHCP, DS, and STCP pins of the shift register 74HC595 are connected to the P2.3, P2.4, and P2.5 pins of the STC89C52RC microcontroller. The high and low level changes of these pins have been set by the circuit program to perform initialization and trigger control timing signals, realizing serial data input, shifting, storage, and output. The OE enable pin of the shift register 74HC595 is connected to one of the Y0-Y15 pins of the 74HC154D, that is, the OE of one 74HC595D is connected to one of the Y0-Y15 output pins of the 74HC154D. The Q0-Q7 pins of the shift register 74HC595 are connected to relays and / or controlled devices.

[0011] Furthermore, the USB-to-serial circuit includes a CH340G chip. The UD+ and UD- pins of the CH340G chip are connected to the D+ and D- pins of the USB chip, respectively. The VCC and GND pins of the USB chip are also connected to the VCC and GND pins of the CH340G chip to drive its operation. The TXD pin of the CH340G chip is connected to the RXT pin of the STC89C52RC microcontroller, and the RXD pin is connected to the TXD pin of the STC89C52RC microcontroller. In this way, the RS232 serial port of the STC89C52RC microcontroller communicates with the USB of a computer or other external devices via the USB-to-serial circuit.

[0012] Furthermore, the reset circuit includes a tactile switch, capacitor C3, and polarized capacitor C3' connected to the RST pin of the STC89C52RC microcontroller. The other ends of the tactile switch, capacitor C3, and polarized capacitor C3' are all connected to VCC. Meanwhile, the RST pin of the STC89C52RC microcontroller is connected to GND through resistor R1.

[0013] Furthermore, the LCD display circuit includes an LCD screen connected to the eight I / O ports P0.0-P0.7 of the STC89C52RC microcontroller, and the eight I / O ports P0.0-P0.7 of the STC89C52RC microcontroller are also connected to a pull-up resistor array RN1.

[0014] Furthermore, the power supply circuit is powered by a 5V power supply or USB power supply.

[0015] The testing steps for this system are as follows:

[0016] 1) In the default initial state, the MR pin of shift register 74HC595 is connected to a high level, and it will not perform a reset operation. The data in shift register 74HC595D will remain unchanged.

[0017] 2) By default, the OE pins of all shift registers 74HC595D are set to high level in the initial state.

[0018] 3) The computer sends serial port commands to the STC89C52RC microcontroller via RS232. After receiving the command, the microcontroller responds by switching the level. By controlling the high and low levels of pins A0 to A3 in the 74HC154D, the outputs Y0 to Y15 can be selected.

[0019] 4) After one of the Y0 to Y15 pins in the 74HC154D goes low, the OE pin of the corresponding shift register 74HC595 goes low, and the output pin of the 74HC154D (one of Q0 to Q7) can work normally, thereby controlling the closure of multiple relays and / or controlled devices to achieve the effect of controlling the power-on and power-off test of the product.

[0020] 5) The 74HC595D will not work if other OE pins are high;

[0021] 6) When the relay and / or controlled equipment malfunctions or there are special requirements, the tester can directly press the tactile switch of the reset circuit to pull the level low and reset the STC89C52RC microcontroller. This is equivalent to restarting, but without disconnecting the power.

[0022] Furthermore, in step S5, by doing so, one 74HC154D can connect to a maximum of 16 74HC595Ds, and one 74HC595D can connect to 8 output peripherals, such as relays. Thus, the cascading expansion of a group of 74HC154Ds and 74HC595Ds can achieve a maximum selection and control of 128 peripheral products.

[0023] The beneficial effects achieved by this utility model due to the adoption of the above technical solution are as follows:

[0024] This invention utilizes the general-purpose I / O ports of a microcontroller, cascading a 74HC154D multiplexer and a 74HC595 shift register to control the on / off state of multiple relays, thereby achieving the effect of selectively controlling the power-on / off state of products. It then communicates with a computer via an RS232 serial port. Based on the test results, specific software sends different commands to the microcontroller through the serial port, thereby controlling the selection and switching of products. This automated test system platform can be extended to implement all tests that do not require additional operation. It powers on the product, tests it, and automatically switches to the next product after completion, repeating this process until the entire batch of machines has been tested, then switching to the next batch for further testing.

[0025] This invention utilizes a computer to send serial commands to an STC89C52RC microcontroller via RS232. Upon receiving the command, the microcontroller responds by switching the corresponding level, thereby controlling the closure of multiple signal relays to control the power supply to the product. Some products only require power on and the testing program to be started; no further operation is needed, just wait for the test to finish. This automated testing system can be used for such products. Machines can be batched together, connected through this system, and testing can begin completely automatically, eliminating the need for manual plugging and unplugging of machines, reducing manpower and improving production efficiency.

[0026] This invention enables automated product testing, allowing for rapid and accurate testing of products. It completes a large number of testing tasks in a short period of time, reducing human resource investment and testing cycles, accelerating product delivery, and improving production efficiency. Furthermore, due to its automated nature, it improves testing accuracy and consistency, reduces labor costs, minimizes manual operation and human resource investment, and enhances production efficiency and economic benefits.

[0027] This utility model has broad market prospects, and the research and development of automated testing systems for production testing shows promising market potential. With technological advancements and increasing market demand, it will play an important role in various fields. Attached Figure Description

[0028] Figure 1 This is a circuit block diagram of the present invention.

[0029] Figure 2 This is a pin definition diagram of the STC89C52RC microcontroller in this utility model.

[0030] Figure 3 This is the circuit schematic diagram of the STC89C52RC microcontroller in this utility model.

[0031] Figure 4This is a pin definition diagram of the 74HC154D in this utility model.

[0032] Figure 5 This is the circuit schematic diagram of the 74HC154D in this utility model.

[0033] Figure 6 This is a pin definition diagram of the 74HC595D in this utility model.

[0034] Figure 7 This is the circuit schematic diagram of the 74HC595D in this utility model.

[0035] Figure 8 This is a circuit diagram showing the connection between two 74HC595Ds and a 74HC154D in this invention.

[0036] Figure 9 This is a circuit diagram of the USB to serial port circuit in this utility model. Detailed Implementation

[0037] The present invention will be further described in detail below with reference to the embodiments.

[0038] An automated product testing system based on a C52 microcontroller, such as Figure 1 It includes the STC89C52RC microcontroller, which is connected to a selection trigger circuit, an LCD display circuit, a power supply circuit, a reset circuit, and a USB to serial port circuit. The USB to serial port circuit connects to the computer via USB.

[0039] The selection trigger circuit includes a 74HC154D multiplexer connected to the I / O pins of the STC89C52RC microcontroller, and a 74HC595D shift register connected to both the STC89C52RC microcontroller and the 74HC154D multiplexer. There are multiple 74HC595D shift registers connected to the 74HC154D multiplexer in a cascaded manner. The output of each 74HC595D shift register is connected to a relay and / or a controlled device.

[0040] The four I / O pins P1.4, P1.5, P1.6, and P1.7 of the STC89C52RC microcontroller are connected to the A0, A1, A2, and A3 pins of the 74HC154D. The VCC pin of the 74HC154D is connected to a 5V power supply, and the E0 and E1 enable pins of the 74HC154D are connected to GND. The Y0-Y15 pins of the 74HC154D are used as output pins.

[0041] The SHCP, DS, and STCP pins of the shift register 74HC595 are connected to the P2.3, P2.4, and P2.5 pins of the STC89C52RC microcontroller. The high and low level changes of these pins are set through a circuit program to initialize and trigger control timing signals, realizing serial data input, shifting, storage, and output. The program is simple, involving high and low level switching, and is not complex, falling within the scope of existing technology. The OE enable pin of the shift register 74HC595 is connected to one of the Y0-Y15 pins of the 74HC154D, meaning that the OE of one 74HC595D is connected to one of the Y0-Y15 output pins of the 74HC154D. The Q0-Q7 pins of the shift register 74HC595 are connected to relays and / or controlled devices.

[0042] The USB-to-serial circuit includes a CH340G chip. The UD+ and UD- pins of the CH340G chip are connected to the D+ and D- pins of the USB chip, respectively. The VCC and GND pins of the USB chip are also connected to the VCC and GND pins of the CH340G chip to drive its operation. The TXD pin of the CH340G chip is connected to the RXT pin of the STC89C52RC microcontroller, and the RXD pin is connected to the TXD pin of the STC89C52RC microcontroller. In this way, the RS232 serial port of the STC89C52RC microcontroller communicates with the USB of a computer or other external devices via the USB-to-serial circuit.

[0043] The reset circuit includes a tactile switch, capacitor C3, and polarized capacitor C3' connected to the RST pin of the STC89C52RC microcontroller. The other ends of the tactile switch, capacitor C3, and polarized capacitor C3' are all connected to VCC. Meanwhile, the RST pin of the STC89C52RC microcontroller is connected to GND through resistor R1.

[0044] The LCD display circuit includes an LCD screen connected to eight I / O ports (P0.0-P0.7) of the STC89C52RC microcontroller. Additionally, pull-up resistor array RN1 is connected to these eight I / O ports.

[0045] The power supply circuit is powered by a 5V power supply or USB power supply.

[0046] The testing steps of this automated testing system are as follows:

[0047] 1) In the default initial state, the MR pin of shift register 74HC595 is connected to a high level, and it will not perform a reset operation. The data in shift register 74HC595D will remain unchanged.

[0048] 2) By default, the OE pins of all shift registers 74HC595D are set to high level in the initial state.

[0049] 3) The computer sends serial port commands to the STC89C52RC microcontroller via RS232. After receiving the command, the microcontroller responds by switching the level. By controlling the high and low levels of pins A0 to A3 in the 74HC154D, the outputs Y0 to Y15 can be selected.

[0050] 4) After one of the Y0 to Y15 pins in the 74HC154D goes low, the OE pin of the corresponding shift register 74HC595 goes low, and the corresponding output pin of the 74HC154D (one of Q0 to Q7) can work normally, thereby controlling the closure of multiple relays and / or controlled devices to achieve the effect of controlling the power-on and power-off test of the product.

[0051] 5) 74HC595Ds with other OE pins high will not work; in this way, this system can connect up to 16 74HC595Ds to one 74HC154D, and one 74HC595D can connect to 8 output peripherals. If the output peripherals can be relays, then the cascading expansion of a group of 74HC154Ds and 74HC595Ds can achieve a maximum of 128 output peripherals to be selected and controlled.

[0052] 6) When the relay and / or controlled equipment program malfunctions or there are special requirements, the tester can directly press the tactile switch of the reset circuit to pull the level low and reset the STC89C52RC microcontroller, which is equivalent to restarting, but without powering off. The tester / operator can press this reset button to reset the entire system.

[0053] The following explanation, in conjunction with the accompanying drawings, provides further details.

[0054] The STC89C52RC microcontroller only has 32 general-purpose I / O interfaces. After deducting a few for control purposes, only about 30 can be connected normally. If a single STC89C52RC microcontroller is used to connect control signal relays, it can only control a maximum of 30 products, which is inefficient. To control more, such as hundreds of products, more microcontroller chips are needed, increasing cost and the complexity of the control program. Therefore, this patent uses a cascaded 74HC154D multiplexer and a 74HC595 shift register to multiplex a single I / O port, thereby controlling more signal relays.

[0055] The STC89C52RC is a high-performance, feature-rich microcontroller chip from STC, and is relatively inexpensive, making it suitable for low-cost projects and applications with limited resources. Its pin definitions and circuit principles are as follows: Figure 2 , Figure 3 As shown.

[0056] A brief introduction to the STC89C52RC microcontroller:

[0057] Processor core: The STC89C52RC uses a processor core based on the MCS-51 instruction set, which has powerful processing capabilities and high instruction execution efficiency.

[0058] Memory: This microcontroller has 8KB of built-in flash program memory and 256B of RAM data memory, which can meet the needs of program and data storage.

[0059] Peripheral interfaces: The STC89C52RC has a variety of peripheral interfaces, including UART (serial communication), timer / counter, I2C bus interface, SPI serial interface, etc., which can be flexibly applied to various application scenarios.

[0060] IO pins: This microcontroller has 32 general-purpose IO pins, which facilitates the connection of external devices and sensors to realize data input / output and control operations.

[0061] Clocks and Timers: The STC89C52RC has a built-in crystal oscillator and multiple timers / counters for precise time measurement and timing functions.

[0062] Power Management: The microcontroller has multiple low-power modes and power management functions, which can effectively extend battery life and reduce power consumption.

[0063] Figure 3In this circuit, U1 represents the STC89C52RC microcontroller. The RST pin connects to the reset circuit. Pressing the tactile switch pulls the level low, resetting the microcontroller. When the program malfunctions or there are special requirements, the microcontroller can be directly reset via the reset circuit, essentially restarting without powering off. XTAL1 and XTAL2 connect to a 12MHz crystal oscillator. This is the microcontroller's minimum system circuit; the microcontroller can only start working normally after the crystal oscillator begins oscillation. The eight I / O ports P0.0-P0.7 connect to an LCD screen, displaying information for easy observation. As you can see, P0.0-P0.7 also have a pull-up resistor array connected to the display. This is to ensure the stability, reliability, and power consumption optimization of the microcontroller's P0 port input signal. Therefore, when designing the circuit, it's common to consider using pull-up resistors of appropriate values. This effectively solves problems such as floating states, level drift, and interference, ensuring the normal operation of the system. P3.0 RXD is the data receive pin, and P3.1 TXD is the data transmission pin. These two pins are typically used in serial communication protocols (such as UART, RS-232, etc.) to send and receive data with external devices in microcontrollers or electronic devices. The TXD pin transmits data, and the RXD pin receives data. During communication, the transmitter's TXD pin is connected to the receiver's RXD pin, and vice versa. Simply put, it's the reverse of the two pins on a serial cable to achieve bidirectional communication and establish a two-way communication link.

[0064] Figure 4 , Figure 5 The 74HC154D is an integrated circuit chip, a member of the 74HC series. It is a 4-to-16 decoder / multiplexer (IC) chip with a wide range of applications. Its main function is to encode a 4-bit binary input into one of 16 output signals. It has 4 input pins (A0-A3) and 16 output pins (Y0-Y15). Based on the combination of input signals, the chip selects the corresponding output pin and sets it to a high level. This encoding and selection function makes the 74HC154D very useful in digital and logic circuit design.

[0065] This design uses four I / O pins (P1.4, P1.5, P1.6, and P1.7) of the microcontroller and A0, A1, A2, and A3 of the 74HC154D. VCC is connected to a 5V power supply, and the E0 and E1 enable pins are grounded. By controlling the changes in high and low levels, the outputs Y0-Y15 are selected. For example, setting A0-A3 to low level results in 0000 (4-bit binary code), making Y0 low and Y1-Y15 high. In this case, only Y0 output is valid, and the others are invalid. The pin definitions and principles are as follows. Figure 4 , Figure 5 As shown.

[0066] Figure 6 , Figure 7 The 74HC595D is a serial-in, parallel-out (Serial-In, Parallel-Out) shift register chip. It has 8 bits of data memory and 8 parallel output pins. Its functions are as follows:

[0067] Data Expansion: The 74HC595D allows a limited number of I / O pins to be expanded into more output pins via serial data input. With eight parallel output pins, it can sequentially store 8 bits of data into registers via serial input and simultaneously output this data to external devices when needed, thus fulfilling greater control or drive requirements.

[0068] Serial data transmission: The 74HC595D receives data via the serial input (SER) pin and uses the serial clock (SRCLK) pin for synchronization timing control. Data can be sequentially input into registers via the serial input, and data shifting operations are completed under the control of the clock. This serial data transmission method is widely used in many applications, such as LED displays, digital tube drivers, and I / O port expansion.

[0069] Parallel data output: The 74HC595D outputs the data stored in the registers to external devices simultaneously through eight parallel output pins (Q0-Q7). Each output pin corresponds to one storage bit, and the stored data is output in parallel all at once after the shift operation is completed.

[0070] Cascading Expansion: The number of output pins can be further expanded by cascading multiple 74HC595D chips. Serial data can be transferred between multiple chips by connecting the serial output (Q7) of one chip to the serial input (SER) of the next chip. This enables larger-scale data storage and parallel output.

[0071] In summary, the 74HC595D, as a serial input parallel output shift register chip, can be used for applications such as data expansion, serial data transmission, parallel data output, and cascading expansion. It is particularly suitable for achieving large-scale control and drive requirements with limited I / O pin resources.

[0072] Pin definitions and circuit principles are as follows Figure 6 , Figure 7 As shown, the following is a description of the functions of some important pins in the 74HC595D chip:

[0073] **DS (Data Serial Input)**: DS is the data serial input pin, used to receive data bits to be stored in a register. Data is shifted and transferred on the clock edge. By continuously using the DS pin, data bits can be input into the register one after another.

[0074] **STCP (Storage Register Clock Input)**: STCP is the storage register clock input pin, i.e., the storage clock. By inputting a high-level signal to the STCP pin, the data in the storage register can be latched and stored in the output register. After the shift operation is complete, the data should be refreshed to the output pin by triggering the rising edge of the STCP pin.

[0075] **SHCP (Shift Register Clock Input)**: SHCP is the shift register clock input pin, i.e., the shift clock. By inputting a clock signal into the SHCP pin, data can be shifted bit by bit from the serial input (DS) to the storage register.

[0076] **OE (Output Enable)**: OE is the output enable pin, which controls the enabling and disabling of the output pin. The output pin can only function normally when the OE pin is low. When the OE pin is high, the output pin is disabled, and the data on the output pin will be invalid.

[0077] **MR (Master Reset)**: MR is the master reset pin, used to reset the chip and clear the data stored in the registers. Providing a low-level pulse to the MR pin clears the data in the registers and resets the pins in the output registers to their default states. These pins work together, using control and timing signals to achieve serial input, shifting, storage, and parallel output of data. By triggering the STCP pin at the appropriate time, data in the registers can be latched and refreshed to the output pins. The OE and MR pins provide output enable and reset control functions to meet specific application requirements.

[0078] In this design, the pins are connected as follows: MR is connected to a high level; the chip will not be reset, and the data in the registers will remain unchanged. SHCP, DS, and STCP are connected to pins P2.3, P2.4, and P2.5 of the microcontroller. The high and low levels of these pins are programmed to perform initialization and trigger control timing signals, enabling serial data input, shifting, storage, and output. The OE enable pin is the most important; it is connected to one of the Y0-Y15 pins of the 74HC154D. For each 74HC595D, connect to one of the 74HC154D's output pins, Y0 or Y1, etc. In the default initial state, OE is set to a high level. After Y0 goes low, OE goes low, and the output pin can function normally. Other 74HC595Ds at high levels will not operate. This allows one 74HC154D to connect to up to 16 74HC595Ds, and one 74HC595D to connect to 8 output peripherals, such as relays. Thus, a cascaded expansion of a group of 74HC154Ds and 74HC595Ds can achieve the maximum control of 128 peripheral devices, maximizing efficiency and resource utilization. The circuit for connecting two 74HC595Ds to a 74HC154D is as follows... Figure 8 As shown. Figure 8 This circuit schematic is designed to control 16 output peripherals. If more need to be controlled, simply add more 74HC595Ds. One 74HC154D can connect up to 16 devices, which can control 16*8=128 devices.

[0079] C52 microcontrollers typically use a serial port (UART) to communicate with computers or other external devices. Computers generally communicate via RS232 serial ports. Because RS232 and microcontrollers are electrically incompatible, a TTL-RS232 converter is needed to convert the voltage levels and protocols. A TTL-RS232 converter module can convert the computer's RS232 interface to a TTL level signal suitable for the microcontroller. This module allows the computer and microcontroller to be connected via a serial port for programming and communication. However, requiring an additional TTL-RS232 converter for microcontroller programming is inconvenient and increases costs. This design uses the CH340G USB-to-serial chip, which provides an economical and practical solution for converting a USB interface into a serial communication interface. It allows the computer to communicate serially with external devices via USB, transmitting data like a serial port, enabling data sending and receiving. The CH340G chip supports mainstream serial communication standards such as UART, RS232, and RS485. It is easily compatible with various serial communication devices and features automatic baud rate detection and automatic flow control, improving communication stability and flexibility. The CH340G chip employs a low-power design with low operating current, providing efficient energy management and reducing system power consumption.

[0080] In summary, the CH340G is a powerful USB-to-serial chip that provides stable and reliable USB-to-serial conversion, suitable for various embedded systems and electronic devices. Its simple driver installation, support for multiple serial port specifications, and wide range of applications make it a top choice for many developers and manufacturers. The chip pin definitions and circuit diagram connections are as follows:

[0081] like Figure 9 After the USB cable arrives, data D+ and D- connect to UD+ and UD- of the CH340G. The VCC and GND of the USB cable are connected to the VCC and GND of the chip to drive the chip to work. TXD connects to the RXT of the microcontroller, and RXD connects to the TXD of the microcontroller. The data receiving and transmitting are reversed to realize a bidirectional communication link, enabling communication with the computer simply by plugging in the USB cable. The computer can receive or send commands to the computer to perform corresponding operations.

[0082] This product's automatic testing system utilizes the general-purpose I / O ports of a microcontroller, cascading a 74HC154D multiplexer and a 74HC595 shift register to control the on / off state of multiple relays, thereby selectively controlling the power-on / off state of the products. It then communicates with a computer via an RS232 serial port. Based on the test results, specific software sends different commands to the microcontroller through the serial port, controlling the selection and switching of products. This automatic testing system platform can be extended to implement all tests that do not require additional operation. It powers on the product, tests it, and automatically switches to the next product after completion, repeating this process until the entire batch of machines is tested, then switching to the next batch for further testing.

[0083] In use, this invention can be used after loading instructions onto the microcontroller. The control instructions are set and matched according to different products because the test programs for each product are different and must be adapted. The microcontroller's operation itself is basically fixed, proceeding sequentially from the first device to the last.

[0084] This utility model's testing system is designed for testing that requires no manual intervention. For example, a product only needs to be powered on, and the testing program can be opened to automatically start the test until the results are displayed; no manual operation is required. When using the testing system, first connect all the devices under test (DUTs) to the power supply lines from the relays in the system. The power supply should be adjusted according to actual conditions; 5V-250V is suitable. After connecting, power on the main power line of the devices, and then power on the testing system. At this point, the system will default to powering on the first device, while the rest will be powered off. Then, based on different test instructions, an automatic simulated human click command will be generated, which includes simple operations such as clicking "Start" and confirming "OK". If the first machine fails the test, a "PASS" prompt will pop up on the interface, and the system will automatically click "OK" and send a simple command to the testing system. Upon receiving the command, the testing system will switch to powering on the next device while simultaneously powering off the previous device. This process can be repeated until all machines are tested, without requiring manual operation. Of course, situations such as computer crashes or system failures are unavoidable, in which case manual restart is required; these are special cases.

Claims

1. An automatic product testing system based on a C52 microcontroller, characterized in that: The single-chip microcomputer STC89C52RC is connected with a selection trigger circuit, an LCD display circuit, a power supply circuit, a reset circuit and a USB-to-serial port circuit, and the USB-to-serial port circuit is connected with a computer through a USB. The selection trigger circuit comprises a multiplexer 74HC154D connected with I / O pins of the single-chip microcomputer STC89C52RC, and a shift register 74HC595D connected with the single-chip microcomputer STC89C52RC and the multiplexer 74HC154D, wherein the shift register 74HC595D is in a plurality, and the plurality of shift registers 74HC595D are connected with the multiplexer 74HC154D in a cascade mode, and an output end of each shift register 74HC595D is connected with a relay and / or a controlled device. The P1.4, P1.5, P1.6 and P1.7 I / O pins of the single-chip microcomputer STC89C52RC are connected with the A0, A1, A2 and A3 pins of the 74HC154D, the VCC pin of the 74HC154D is connected with a 5V power supply, and the E0 and E1 enable end pins of the 74HC154D are connected with GND; the Y0-Y15 pins of the 74HC154D are used as output pins. The SHCP, DS and STCP pins of the shift register 74HC595 are connected with the P2.3, P2.4 and P2.5 pins of the single-chip microcomputer STC89C52RC; the OE enable pin of the shift register 74HC595 is connected with one of the Y0-Y15 pins of the 74HC154D, and the Q0-Q7 pins of the shift register 74HC595 are connected with a relay and / or a controlled device.

2. The automatic product testing system based on C52 single-chip microcomputer according to claim 1, characterized in that: The USB-to-serial port circuit comprises a CH340G chip, the UD+ and UD- pins of the CH340G chip are connected with the D+ and D- pins of a USB, the VCC and GND pins of the USB are connected with the VCC and GND pins of the CH340G chip to drive the CH340G chip to work, the TXD pin of the CH340G chip is connected with the RXT pin of the single-chip microcomputer STC89C52RC, and the RXD pin of the CH340G chip is connected with the TXD pin of the single-chip microcomputer STC89C52RC.

3. The automatic product testing system based on C52 single-chip microcomputer according to claim 1, characterized in that: The reset circuit comprises a touch switch, a capacitor C3 and a polar capacitor C3' connected with the RST pin of the single-chip microcomputer STC89C52RC, and the other ends of the touch switch, the capacitor C3 and the polar capacitor C3' are connected with VCC, and the RST pin of the single-chip microcomputer STC89C52RC is connected with GND through a resistor R1.

4. The automatic product testing system based on C52 single-chip microcomputer according to claim 1, characterized in that: The LCD display circuit comprises a liquid crystal display screen connected with the P0.0-P0.7 I / O ports of the single-chip microcomputer STC89C52RC, and the P0.0-P0.7 I / O ports of the single-chip microcomputer STC89C52RC are further connected with a pull-up resistor RN1.

5. The product automatic test system based on C52 single-chip microcomputer according to claim 1, characterized in that: The power supply circuit is powered by a 5V power supply or a USB.

6. The automatic test system based on C52 single-chip microcomputer according to claim 5, characterized in that: This product automatic test system reaches 1 74HC154D most can connect 16 74HC595D, a 74HC595D can connect 8 output peripherals, so, a group of 74HC154D and 74HC595D cascade expansion, can reach the maximum selection control 128 output peripherals product connection.