introduction
With the rapid development of computer technology, the transformation of CNC systems from traditional dedicated closed systems to flexible open CNC systems has become an inevitable trend. Compared with traditional closed CNC systems, open CNC systems have the following advantages:
Scalability: the functions and scale (hardware or software modules) of the CNC system can be flexibly increased or decreased according to specific applications;
Portability: the system's functional software is independent of the operating platform and can run on hardware platforms provided by different suppliers;
Scalability: developers can effectively integrate their own software into the NC system to form their own dedicated system;
Interoperability: Through standardized interfaces, communication and interaction mechanisms, different functional modules can obtain interoperability and coordinate work.
At present, the main form of open CNC system is PC-based NC, that is, a motion controller with NC function is plugged into the bus of PC to complete the NC kernel function with high real-time requirements. This project is based on the MPC08 motion controller of Stepping Electromechanical Co., Ltd., which is a general motion controller with high cost performance that can meet the functional requirements of CNC system. The project conducts research on CNC system software based on the process of drilling machine.
1 System overall structure
The CNC drilling machine of this system has 8 axes, namely X, Y axis and Z1, Z2, Z3, Z4, Z5, Z6 axis. Among them, X, Y axis control the positioning in two directions of the plane, Z1, Z2, Z3, Z4, Z5, Z6 control the feed amount of drilling, and XYZ can be controlled in linkage. During processing, according to the hole coordinates, hole diameter, hole depth and other parameters on the workpiece to be processed, the processing file of the workpiece is compiled, and the system controls the machine tool to complete the drilling process according to the processing file.
In order to control the 8 axes of the machine tool, we use the MPC08 motion controller as the core of the system control and insert it into the PCI slot of the PC. The industrial PC is used as the main control computer to complete the communication with the MPC08 controller and the upper system operation, scheduling management, fault diagnosis, parameter input and other non-real-time tasks.
MPC08 is an open universal motion controller. All instructions are immediate instructions. It is suitable for high-speed and accurate point motion of PCB drilling machines. It has enough dedicated and general IO channels for machine tool control. The software provides a wealth of motion control functions for users to develop independently on the Windows platform and build the required CNC system. We insert MPC08 into the PCI slot of the PC and use it to complete the control of the entire system.
The IO and feedback system uses the dedicated and general input and output channels of MPC08 to connect and control the IO signals of various machine tool electrical appliances; the drive and servo stepper motor units receive the pulse and direction signals sent by MPC08 to complete the required movement.
The frequency converter and spindle rotation control part uses the serial port of the PC to communicate with the frequency converter, thereby completing the control of the spindle speed. This control is independent of MPC08.
2 Software Structure Design
In order to meet the requirements of scalability, portability, extensibility and interoperability, the software adopts the idea of modular design and is developed on the Windows 2000 operating system using the Visual C++ 6.0 development tool. The software is generally divided into two parts: the human-computer interface interaction part and the system control part.
1) Human-machine interface The human-machine interface module mainly completes the status display of the entire CNC system and the input of required parameters. In addition, the interface should be friendly and easy to use. This program design uses the powerful functions of the CWnd class and CButton button class in the MFC library, and uses the member functions of these two classes and the subclasses derived from the class to construct a friendly and convenient interface. The interface includes the display of important parameters during the processing, the display of main function buttons and processing graphics. The parameters display includes the coordinates of each axis, the working stroke, the lower dead point, the tool code, the diameter, the offset, the number of holes processed, the record of the tool magazine, etc.; the function buttons include start, return to the origin, return to the parking space, import files, tool parameters, tool management, processing parameters, etc. Among them, the tool parameters, tool management and processing parameters buttons can also open other interfaces to complete the system functions; the graphic display is located in the middle part of the interface to display the graphics of the processed PCB holes, and the processing process can also dynamically display the processing of a certain hole.
2) Processing Files The processing file function module completes the decoding of the external input processing files (Excellon format files commonly used in the PCB industry) and converts the information of the processing files into the data format required by the control system. The specific implementation method of the software is to interpret each line of the file, and put each tool node data to be processed in a WORK_NODE structure according to the interpreted information, and put the corresponding hole processing data under the tool in the RECORD_NODE structure in the WORK_NODE. Finally, each tool node is uniformly stored in the processing linked list gWorkList with WORK_NODE as the type. The data structure of WORK_NODE and RECORD_NODE is as follows:
typedef struct _WORK_NODE
{
int Type; //Tool type,
int ToolNo; //Tool number T0, T1......
double Diameter; //mm diameter
double VelocityForZUp; //Increase speed
double VelocityForZDown; //Drilling speed mm/min
double Offset; //Drilling allowable offset in mm
int Rev; //spindle speed rpm/minute
int MaxLife, HitCount; //Lifespan
int ToolCurNo; //The tool magazine number of the current tool
CRecordList *pList; //hole coordinate list
}WORK_NODE,*PWORK_NODE;
typedef struct _RECORD_NODE
{
double x; //x coordinate
double y; //y coordinate
}RECORD_NODE,*PRECORD_NODE;
3) Processing parameter management This function completes the management of various parameters in the machine tool control process, including the machine's axis parameters, system parameters, processing parameters, tool parameters, and machine tool coordinate parameters. In order to facilitate management and use, the above parameter programs define global variables for storage. When using these variables, you can read and modify various parameters. Each parameter variable is a custom structure type. The axis parameter type includes the enable, maximum speed, maximum acceleration, pulse equivalent, zero return speed, zero return direction, reverse clearance, etc. of each axis; system parameters include interpolation accuracy, in-place detection cycle, tool magazine coordinate position, depth detection depth, depth detection speed; processing parameters include feed speed, lifting speed, working stroke, spindle speed, tool change mode, and broken drill detection allowable range; tool parameters include tool type, diameter, life, service life, and tool magazine number; machine tool coordinate parameters include absolute and relative coordinate parameters of the machine tool. All of these parameters, except for absolute and relative coordinate parameters, need to be entered by the user as required before processing, and movement is performed according to these set data during processing. The following is an example of the data structure of axis parameters:
typedef struct _AXIS_PARAM_SET
{
int Installed; //Is the axis installed: TRUE——installed
int Enable; //Is the axis valid?
int HomeDir; //Machine tool return direction: 1 - forward, -1 - reverse, 0 - invalid
double Interval; //Reverse gap
&nb, sp;&n, bsp; double MaxSpeed; //Maximum speed (mm/min) (A)
double AccelSpeed; //Maximum acceleration (mm/min︿2) 3600000
double PulseFactor; //Pulse equivalent (mm)
long PulseUp; //Electronic gear molecule
long PulseDown; //Electronic gear denominator
long PulseDir; //Feedback direction
int SRatio; //S-type acceleration curve coefficient
double HomeSpeed; //Home speed
double HomeCheckDis; //Return to zero detection length
double HomeOffsetDis; //Moving distance after returning to zero
double DepthCheckDis; //Depth detection descent distance
}AXIS_PARAM_SET,*PAXIS_PARAM_SET;
4) Motion and tool change control Motion and tool change control is the core part of drilling machine motion, completing the drilling machine's hole processing (including starting, positioning, drilling, lifting), returning to zero, returning to parking position and tool change. The code of this module is executed in the specially established motion control thread PubWorkThreadHandler (LPVOID pParam).
a. Hole processing When the user is ready for processing and presses the button to start processing, the thread automatically starts to read the decoded data in the processing list gWorkList, and sends motion instructions to the MPC08 motion controller according to the speed set by the processing parameter management module through the known data information program. The controller sends a pulse to make the machine tool move quickly and position to the hole coordinates, and then performs hole processing at a given drilling speed and drilling depth, and then lifts at a given speed, while quickly positioning to the coordinate position of the next processing hole.
b. Zero return Accurate zero return plays an important role in the positioning and processing of machine tools. The zero return method designed in this system uses the Z pulse of the servo motor. When the zero return button is pressed, the motion control thread of the program sends a zero return command to the controller according to the corresponding steps, so that the machine tool can accurately return to zero. The designed zero return steps are: each axis moves quickly toward the origin à slowly stops after touching the origin switch à moves in the opposite direction at a low speed after slowing down à stops after receiving the Z pulse signal of the servo motor. The machine tool uses the coordinate position where it stops as the origin of the machine tool. A macro is defined for each step in the program to distinguish which step is processed.
c. Return to parking position When the return to parking position button is pressed, a return to parking position command is issued, causing the XY axis of the machine tool to move to the parking position coordinates set in the processing parameter management module before processing.
d. Tool change When drilling PCB boards, it is necessary to process holes of different diameters. This requires that the tool must be changed after processing a hole of one diameter, and a tool of another diameter must be used for processing. This system has two tool change modes: manual tool change and automatic tool change. Manual tool change means that after processing a hole of one diameter or when the tool life is up, the machine returns to the parking position, and the operator manually removes the original tool and replaces it with a new one before resuming processing. Compared with the efficiency of manual tool change, current machine tools generally adopt automatic tool change. The tool change process designed this time is as follows:
Z axis returns to zero - presser foot is raised - X axis moves to the original tool magazine position - Y axis moves to the original tool magazine position - Z axis moves to the tool change position - open the chuck to release the tool - delay - Z axis returns to zero - XY axis returns to the pause position - check that the tool is put back - Z axis returns to zero - returns to the pause position - X axis moves to the target tool position - Y axis moves to the target tool position - Z axis moves to the tool change position - close the chuck to take the tool - delay - Z axis returns to zero - returns to the pause position - check that the tool is taken - Z axis returns to zero - XY axis returns to the pause position - presser foot is lowered
The software implementation of tool change is also completed step by step in the motion control thread according to the above steps. Each step is distinguished by a macro, similar to the zero return step. When the entire tool change process is completed, the machine tool continues to process the remaining holes.
5) Self-diagnosis detection The self-diagnosis module plays an important role in the debugging, detection and status monitoring of machine tools. Through this module, users can detect the status of machine tool electrical signals at any time, including the signals input from the machine tool to the controller and the control signals output from the user to the machine tool through the controller. In the program, another auxiliary thread PubMonitorThreadHandler continuously queries the status register of the MPC08 controller and constructs the following dialog box to display it.
3 Applications
The system takes advantage of the powerful functions of the MPC08 motion controller and performs software programming under the guidance of modularization. It is finally effectively applied to the control system of the PCB drilling machine, with good operation effect. It has passed the high-precision and speed processing test in PCB CNC machine tools. The tool diameter used for processing is 0.1-0.3mm, and the hole spacing is 0.5mm. The maximum speed of each axis and the number of holes drilled per minute have met the expected requirements.
Previous article:Design and implementation of a simple infrared remote control password lock
Next article:Application of UniMAT extension modules in power plants
- Popular Resources
- Popular amplifiers
- A review of deep learning applications in traffic safety analysis
- Raspberry Pi Development in Action (2nd Edition) ([UK] Simon Monk)
- ESP32 steuert Roboterauto Open-Source-Code mit Arduino IDE and PlatformIO Autonomes Fahren GPS, Acce
- Research and design of electric vehicle drive motor ECU control software based on AUTOSAR
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Technical article: The magic of energy monitoring in DC systems
- Please give me some advice on the previous interview questions.
- Powering a Boost Topology Battery Charger with a Solar Panel
- [RISC-V MCU CH32V103 Review] USB flash drive read and write test
- NI Special Month, enjoy up to 40% off on software and more!
- Help: About the ESP32 Anxinke integrated environment project import compilation error
- Various PCB onboard antennas and PCB design points
- 【Silicon Labs Development Kit Review 06】_Transplanting freertos+Vcom+LED
- There is no more comprehensive article about RF chips than this one! Worth saving!
- Supplement: Design of the lower computer for the computer room monitoring project