Implementing Windows multi-threaded open CNC system based on the master

Computer Applications Windows-based multi-threaded open CNC main control system to achieve Zhang Zheng, Ma Shu-gen, Cao Binggang (Xi’an Electrical and Mechanical Services Department machine quit Engineering, Xi’an Jiaotong University, Xi’an 710049, China) How to use multithreading NC system of multi-tasking and multi-tasking of the coordination and synchronization between issues. At the same time, also discussed the issue of NC machine tools serial communication PC (Windows) and slave (DOS) between. The main control system has been used for a CNC machine tools transformation experiments, and achieved good results.
1 lead one hundred existing NC system, most systems are based on DOS environment, and its overall performance is weak with respect to some of the Windows environment, especially in relatively poor interface, human-computer interaction capabilities, multitasking and openness. So, to say, based on the development of master control system of this paper is based on an open architecture CNC machine tools of NC software architecture research. The architecture (shown) is to solve the problem of a closed system and put forward. Under this structure, process software on a Host-PC to run the generated operation information transmitted from the device to the serial port complete digital machine tools.
VC ++ compiled with the master control software system, and verified by experiments, and achieved satisfactory results. The host system can support the processing and machining complex surface gear, greatly simplifies the preparation process of the software.
0, Zhang Zheng (972-) Male, Sanyuan, Shaanxi people, Ph.D., principal research directions numerical control technology, the robot remote control. Measurement data “L. member compares current process of recording system mistakenly credited cMliShM thread is to call el ei new number tf treated to the latest digital bookmark4 Use VC ++ Development of Windows-based open CNC system interface master the main functions of the system such as: automatic assembly processing file; manually edit the automatic processing of documents; tool position adjustment; the machine coordinate origin set; offline simulation tool path trajectory; online real-time simulation tool path trajectory; digital machine status display.
2 Multi-threading technology applied to every Windows application in the master system is a process, by the thread to be responsible for the implementation of the code included in the process address space. In fact, a single process can have multiple threads, which in the process’s address space “simultaneously” executing code. Operating system in a round robin manner for each individual CPU threads allocated time slice, so that almost all the threads simultaneously objectively.
The system is also the basis of all active thread priorities to determine when to call and which thread scheduling long. System for each thread is assigned a priority, from the lowest to the highest 0 31. Regardless of the low-level threads are doing, the thread will always be the first high-level low-level threads.
2.1 thread priority settings in Windows in a thread’s priority is it in the process and determine its relative priority of the process. When a thread is created, it is the priority of the process where the priority class. For example, a REALTIME-PRIORITY-CIASS processes main thread initial priority is 24. However, you can set the thread priority relative to the process to change the thread priority.
Thus, in one application, several threads can be set to different priorities. For example: In the lower position machine communication thread is used: in the time display thread use); / You can set the priority of the thread 16 Table 1 shows how the system according to process priority class and thread priority relative level combining decided thread base priority.
Table 1 how the system determines the basic priority threads in the relative priority of the idle process priority class ordinary high real 2.2 host system thread main control system threads are: display date and GMT. Such as: 002 in Beijing on Monday, January 21 automatic recording thread. When automatic processing, storing received from the lower computer data to a text file. This will preserve the integrity of the data processing, the process recorded. After processing is complete, and the meters take measures in accordance with this document and the actual zero further improve machining accuracy.
Accordance with the three trace view draw in the interface, improved operator control processing schedule and the actual processing conditions.
Finally, verify the correctness of the automatic machining program. So you can find errors, to avoid losses.
Serial communication thread. This thread is responsible for the automatic data processing machine or to adjust the data sent to the lower computer through the serial port, but also read the next bit machine machine status data coming from the serial port, displayed on the screen.
Each thread priorities described above are shown in Table 2. Table 2 master system several thread priority.
Show Coordinated Universal Time thread thread thread automatically record online offline simulation simulation thread thread priority thread serial communication between each of the threads 23 and the synchronization There are several threads running in parallel environment, synchronize the different threads of activity is very important. Windows are mainly provided in the present five of the main control system mainly used in the critical region and thread synchronization event for synchronization of threads.
The critical area is the small piece of code, it requires to get exclusive access to some shared data before the execution. Critical section allows only one thread to obtain access to a data area. By using the district will be able to ensure access to critical data structures can be coordinated between threads. If a thread has acquired ownership of the critical section, the other wants to gain access to the thread will be put to sleep. When the thread to give up ownership of ownership, the system wakes up only one thread is waiting for, give it a title, and let the other threads continue to sleep. For example, the use of online simulation thread block: Use the block in the main thread: can synchronize online simulation threads and the main thread of the global variable strSimuOnlineX access.
Event is most commonly used to initialize a process work, sends a signal to another thread, let it do the rest. The event is set to initialize the thread state after no signal initializes. When initialization is complete, the thread of the event set to signaled state worker thread to wake implement the remaining work necessary.
In the main control system defines the following main events: rote-eventStart which is used to represent the main thread initialization has been completed, the processing start automatically, you can start recording automatically thread. When this event is signaled state data is written to the file. In automatic recording thread waits for the time to use the signal. When the main thread begins automatic processing, and the crew sent down the first set of data, you can start using the statement recorded automatically thread starts recording. Due to limited space, the specific application of other events will not be discussed.
3Windows between DOS and hardware based RS-232-C serial communication 3.1 serial communication is between data terminal equipment (DTE) and data communications equipment (DCE) interfacing binary exchange can be used to achieve between the two computer close direct communication. Achieve double connection, as long as the two PC serial port or parallel port with the appropriate cable to connect a certain way.
In the 9-pin main control system, using a 9-pin is the three-wire connection.
RS-232-C standard serial interfaces between computers just for communication, electrical characteristics are known by the computer Universal Asynchronous Receiver / Transmitter (UART) device to complete.
DOS serial communication DOS and BIOS provides support for asynchronous serial communication function calls, you can use these function calls to design simple serial asynchronous communication program. Interrupt control mode is the most used serial communication transmit / receive control. Under the next bit PC machines running DOS environment, based on the use of the interrupt mode.
Windows serial communications under Windows, serial port as the system resources, unified management by the device driver, you can not like or directly on the serial port hardware programming under DOS. Windows serial ports and other communication devices such as Modem, fax machines, etc. regarded as a unified file, serial port open, close, read and write operations and also because the operation requires a combination of thread programming Windows, event-driven and other new technologies, thus making Windows programming of serial communication under more complicated.
Serial communication session to call CreateFileC) function to open the serial port start, then set the serial port baud rate, data bits, parity, stop bits and other parameters and timeout parameters, the final choice of a way of working read and write serial mouth. In Windows, there is a serial communication consultation mode and event-driven work in two ways.
Query is the most direct, easy to understand technology. But the inquiry will take a lot of CPU time, less efficient. Event-driven I / O mode refers to a thread I / O operations by monitoring communication resource in a group event, this approach is similar to interrupt work, high efficiency under DOS. The main control system is used in event-driven communication. In the main control system, the establishment of a CSerialPort class used to implement the serial port initialization and read and write operations.
Serial communication 3.4Windows and DOS serial communication between the two operating systems is not difficult, as long as between the two established the correct hardware connection, and then were to write their own communication program, and follow the same set of communication protocols, it you can communicate up. This is the communication system of the host PC and the next crew of implementation, and the communication rate reached 4 Conclusion The main usefulness of the system has been verified by experiments, and achieved good results.

No Comments

rssComments RSS   transmitTrackBack Identifier URI

No comments. Be the first.

addLeave a comment