Dynamic joining method and system for PCB board reference point based on DLL

By dynamically generating PCB board reference points using DLL technology, the problems of code complexity and large workload in traditional methods are solved, and reference point addition and updating are achieved efficiently and simply.

CN114443045BActive Publication Date: 2026-06-09HANGZHOU DIANZI UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU DIANZI UNIV
Filing Date
2021-12-24
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Traditional methods for generating reference points in automated optical inspection of PCBs require engineers to manually write code, resulting in a large workload, low efficiency, and high code complexity, making it difficult to quickly and dynamically add reference points.

Method used

Using DLL dynamic link library technology, the system parses CAD files, calculates reference points for graphics and images, generates DLL files, and dynamically adds reference points by selecting different reference point generation methods based on their IDs.

Benefits of technology

It significantly reduces the programming workload of reference points, improves testing efficiency, simplifies program complexity, and enables rapid dynamic addition and updating of reference points.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114443045B_ABST
    Figure CN114443045B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on the dynamic joining method and system of the reference point of PCB board of DLL, method S1, the ID attribute value of reference point is set;S2, read the CAD file of PCB board, parse CAD element;S3, write graphical reference point calculation program;S4, write image reference point calculation program;S5, write the use program of reference point;S6, generate DLL dynamic link library file;S7, establish the mapping of ID and DLL, and different reference point generation method is selected by ID.The application overcomes the waste of traditional multiple modification program code mode to equipment and human resources etc., using the idea of generating DLL, greatly reduces the programming workload of reference point, can conveniently and quickly realize the dynamic joining of reference point, improves the test efficiency of reference point.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of automatic optical inspection (AOI) of PCB boards, and relates to a method and system for dynamically adding reference points to PCB boards based on DLL. Background Technology

[0002] A PCB (Printed Circuit Board), also known as a printed circuit board, is an important electronic component. It serves as the support for electronic components and the carrier for their electrical interconnections. In automated optical inspection of PCBs, the alignment of the PCB graphic image is an indispensable step. Traditional methods for generating reference points rely on engineers writing code specifically for each PCB element based on their experience. Furthermore, adding reference point generation methods is achieved by adding new functions to the program. Clearly, this traditional method requires engineers to write code for each PCB, resulting in a high workload, reduced efficiency, and difficulties in program management. It also increases code complexity, as each addition of a new reference point method necessitates rewriting and compiling the system to generate a new version. Summary of the Invention

[0003] To address the aforementioned problems in the existing technology, the technical solution of this invention is: a method for dynamically adding PCB board reference points based on DLL, comprising the following steps:

[0004] S1, Set the ID attribute value of the reference point;

[0005] S2 reads the CAD file of the PCB board and parses the CAD elements;

[0006] S3, Write a program to calculate the graphical reference point;

[0007] S4, Write the program to calculate the image reference point;

[0008] S5, Write the program to use the reference point;

[0009] S6 generates a DLL dynamic link library file;

[0010] S7 establishes a mapping between ID and DLL, and selects different reference point generation methods through ID.

[0011] Preferably, step S3 specifically includes the following steps:

[0012] S31, Design a feature parameter table for calculating the reference point of the graph;

[0013] S32, traverse the graphic outlines in the PCB board to obtain graphics that satisfy the features in the graphic feature parameter table;

[0014] S33, use the obtained graphics to calculate the graphic reference point.

[0015] Preferably, step S4 specifically includes the following steps:

[0016] S41, perform coarse alignment of graphics and images, and then obtain the region image of the graphic reference point area in the PCB board scan image;

[0017] S42 uses a contour tracing algorithm to extract pixel-level graphic contours;

[0018] S43, subpixelize the pixel contour to obtain the subpixel contour;

[0019] S44, fits the subpixel contours into the corresponding graphic;

[0020] S45, the image reference point is calculated using the fitted graph.

[0021] Preferably, step S6 specifically includes the following steps:

[0022] S61 combines the graphic reference point calculation program and the image reference point calculation program to obtain a complete reference point generation function interface;

[0023] S62 extracts the reference point usage program code and encapsulates it into a reference point usage function interface;

[0024] S63 uses a compiler to generate DLL files.

[0025] To achieve the above objectives, the present invention also provides a DLL-based system for dynamically adding PCB board reference points, employing the aforementioned method, including:

[0026] Data parsing module: Used to execute S2 to read PCB CAD files and parse CAD elements;

[0027] The graphic search module is used to execute S31, which designs a feature parameter table for calculating the reference point of the graphic, and S32, which traverses the graphic outline in the PCB board to obtain the graphic that satisfies the features in the graphic feature parameter table.

[0028] Graphical reference point calculation module: used to calculate graphic reference points using the obtained graphics in S33;

[0029] Graphic and image fast matching module: used to perform coarse alignment of graphics and images by S41, and then obtain the region image of the graphic reference point area in the PCB board scan image;

[0030] Image Function Module: Used to perform contour extraction, sub-pixel functions, and fitting function functions in the S4 program for calculating image reference points;

[0031] Image reference point calculation module: used to perform S45 to calculate image reference points using the fitted graph;

[0032] DLL module: Used to execute the generation of DLL dynamic link libraries in S6 and the establishment of the mapping between ID and DLL in S7, and to select different reference point generation methods through ID.

[0033] Compared with existing technologies, this invention addresses the problem of dynamically adding reference points to a newly added PCB board. This method overcomes the waste of equipment and manpower resources associated with traditional methods that involve multiple modifications to program code. By employing the concept of generating DLLs (Dynamic Link Libraries, which are libraries containing code and data that can be used by multiple programs simultaneously), it significantly reduces the programming workload for reference points, enabling convenient and quick dynamic addition of reference points and improving testing efficiency. Each reference point generation method is assigned an ID attribute value. The compiler generates DLL files from the code, and different DLLs are selected and added to the program based on the ID attribute, thus achieving dynamic addition of reference points using DLLs.

[0034] This invention can effectively improve work efficiency and reduce program complexity. The reference point generation method can apply updates to various modules by generating DLL files without affecting other parts of the AOI program. Using DLL files, the reference point generation method DLL can be selected manually or automatically based on the characteristics of the PCB board, eliminating the need for frequent code writing. Attached Figure Description

[0035] Figure 1 This is a flowchart illustrating the steps of a DLL-based method for dynamically adding PCB board reference points according to an embodiment of the present invention.

[0036] Figure 2 A diagram of an automated optical inspection system for PCBs using the DLL-based dynamic addition method for PCB reference points according to an embodiment of the present invention;

[0037] Figure 3 This is an interface diagram of the system for dynamically adding PCB board reference points based on DLLs in an embodiment of the present invention.

[0038] Figure 4 This is a flowchart illustrating the automatic reference point generation process of the DLL-based PCB board reference point dynamic addition method in an embodiment of the present invention. Detailed Implementation

[0039] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0040] Conversely, this invention encompasses any substitutions, modifications, equivalent methods, and solutions made within the spirit and scope of the invention as defined in the claims. Furthermore, to provide a better understanding of the invention, certain specific details are described in detail below. However, those skilled in the art will fully understand the invention even without these detailed descriptions.

[0041] Method Example 1

[0042] See Figure 1 The figure shows a method for dynamically adding PCB board reference points based on DLL according to an embodiment of the present invention, which includes the following steps:

[0043] S1, Set the ID attribute value of the reference point;

[0044] S2 reads the CAD file of the PCB board and parses the CAD elements;

[0045] S3, Write a program to calculate the graphical reference point;

[0046] S4, Write the program to calculate the image reference point;

[0047] S5, Write the program to use the reference point;

[0048] S6 generates a DLL dynamic link library file;

[0049] S7 establishes a mapping between ID and DLL, and selects different reference point generation methods through ID.

[0050] S3 specifically includes the following steps:

[0051] S31, Design a feature parameter table for calculating the reference point of the graph;

[0052] S32, traverse the graphic outlines in the PCB board to obtain graphics that satisfy the features in the graphic feature parameter table;

[0053] S33, use the obtained graphics to calculate the graphic reference point.

[0054] S4 specifically includes the following steps:

[0055] S41, perform coarse alignment of graphics and images, and then obtain the region image of the graphic reference point area in the PCB board scan image;

[0056] S42 uses a contour tracing algorithm to extract pixel-level graphic contours;

[0057] S43, subpixelize the pixel contour to obtain the subpixel contour;

[0058] S44, fits the subpixel contours into the corresponding graphic;

[0059] S45, the image reference point is calculated using the fitted graph.

[0060] S6 specifically includes the following steps:

[0061] S61 combines the graphic reference point calculation program and the image reference point calculation program to obtain a complete reference point generation function interface;

[0062] S62 extracts the reference point usage program code and encapsulates it into a reference point usage function interface;

[0063] S63 uses a compiler to generate DLL files.

[0064] This invention also provides a DLL-based system for dynamically adding PCB board reference points, employing the above method, including:

[0065] Data parsing module: Used to execute S2 to read PCB CAD files and parse CAD elements;

[0066] The graphic search module is used to execute S31, which designs a feature parameter table for calculating the reference point of the graphic, and S32, which traverses the graphic outline in the PCB board to obtain the graphic that satisfies the features in the graphic feature parameter table.

[0067] Graphical reference point calculation module: used to calculate graphic reference points using the obtained graphics in S33;

[0068] Graphic and image fast matching module: used to perform coarse alignment of graphics and images by S41, and then obtain the region image of the graphic reference point area in the PCB board scan image;

[0069] Image Function Module: Used to perform contour extraction, sub-pixel functions, and fitting function functions in the S4 program for calculating image reference points;

[0070] Image reference point calculation module: used to perform S45 to calculate image reference points using the fitted graph;

[0071] DLL module: Used to execute the generation of DLL dynamic link libraries in S6 and the establishment of the mapping between ID and DLL in S7, and to select different reference point generation methods through ID.

[0072] Figure 2This invention provides a simple automated optical inspection system for PCBs. In this system, a standard PCB board graphic is designed using CAD software, and the PCB board is manufactured according to the design. An image of the PCB board is generated under a CCD imaging system. The position and scaling of the graphic are corrected by calculating reference points on both the graphic and the image. By comparing the image and the corrected graphic, errors such as short circuits, open circuits, and copper slag on the PCB board can be detected, thus completing the inspection. In this optical inspection system for PCB circuit boards, the invention implements a method for dynamically generating the reference points.

[0073] The system of this invention consists of a data parsing module, a graphic search module, a graphic reference point calculation module, a graphic image fast matching module, an image function module, an image reference point calculation module, and a DLL module. In this example, the data parsing module and the image function module are provided by the AOI master program, and the code for these two modules remains unchanged for different PCB boards.

[0074] In the system implementation examples, see Figure 3 The user interface of this system consists of basic information, parameter input area, graphic code input area, image code input area, and save operation.

[0075] The basic information includes an ID and a name, which are used to identify each reference point generation method. Reference points can be dynamically selected by using the ID.

[0076] The parameter input area consists of a graphics parameter area, a graphics transfer image parameter area, and an image parameter area. The graphics parameter area assists the graphics search module; each box is used to input the required parameter value, with data type either decimal or integer. The graphics transfer image parameter area is used for data transfer; the boxes are divided into parameter type and parameter name, with array type being string. The image parameter area assists the image reference point calculation module; each box is used to input the required parameter value, with data type either decimal or integer.

[0077] The graphics code input area is used to input user-written graphics codes, including codes for the graphics search module and the graphics reference point calculation module; the image code input area is used to input user-written image codes, including codes for the graphics-image fast matching module, the image function module, and the image reference point calculation module; the reference point usage method area is used to input user-written codes for alignment using reference points. In this example, the reference point usage method is the default method. All the codes in the above input areas support C++.

[0078] Clicking the save button will generate a DLL file, corresponding to the DLL module. See the process below. Figure 4The process involves parsing the data in the parameter area into graphics code and image code, generating a new interface based on the ID and name, and integrating the graphics code and image code within this interface to obtain a complete reference point generation function interface. The code for using the reference points is then extracted and encapsulated into the reference point usage function interface. Finally, a DLL file is generated using a compiler. A mapping between IDs and the DLL is established in the program, allowing different reference point generation methods to be selected based on the ID.

[0079] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for dynamically adding reference points to a PCB board based on a DLL, characterized in that, Includes the following steps: S1, Set the ID attribute value of the reference point; S2 reads the CAD file of the PCB board and parses the CAD elements; S3, Write a program to calculate the graphical reference point; S4, Write the program to calculate the image reference point; S5, Write the program to use the reference point; S6 generates a DLL dynamic link library file; S7, Establish a mapping between ID and DLL, and select different reference point generation methods through ID; S3 specifically includes the following steps: S31, Design a feature parameter table for calculating the reference point of the graph; S32, traverse the graphic outlines in the PCB board to obtain graphics that satisfy the features in the graphic feature parameter table; S33, Calculate the graphic reference point using the obtained graphic; S4 specifically includes the following steps: S41, perform coarse alignment of graphics and images, and then obtain the region image of the graphic reference point area in the PCB board scan image; S42 uses a contour tracing algorithm to extract pixel-level graphic contours; S43, subpixelize the pixel contour to obtain the subpixel contour; S44, fits the subpixel contours into the corresponding graphic; S45, calculate the image reference point using the fitted graph; S6 specifically includes the following steps: S61 combines the graphic reference point calculation program and the image reference point calculation program to obtain a complete reference point generation function interface; S62 extracts the reference point usage program code and encapsulates it into a reference point usage function interface; S63 uses a compiler to generate DLL files.

2. A DLL-based dynamic addition system for PCB board reference points, executing the DLL-based dynamic addition method for PCB board reference points as described in claim 1, characterized in that, include: Data parsing module: Used to execute S2 to read PCB CAD files and parse CAD elements; The graphic search module is used to execute S31, which designs a feature parameter table for calculating the reference point of the graphic, and S32, which traverses the graphic outline in the PCB board to obtain the graphic that satisfies the features in the graphic feature parameter table. Graphical reference point calculation module: used to calculate graphic reference points using the obtained graphics in S33; Graphic and image fast matching module: used to perform coarse alignment of graphics and images by S41, and then obtain the region image of the graphic reference point area in the PCB board scan image; Image Function Module: Used to perform contour extraction, sub-pixel functions, and fitting function functions in the S4 program for calculating image reference points; Image reference point calculation module: used to perform S45 to calculate image reference points using the fitted graph; DLL module: Used to execute the generation of DLL dynamic link libraries in S6 and the establishment of the mapping between ID and DLL in S7, and to select different reference point generation methods through ID.