The implementation of real-time control of NC soft

  • Detail

The realization of real-time control of NC software under Windows95

Abstract This paper expounds the interrupt principle of Windows 95, and introduces the method of using VxD to realize interrupt processing. Through the application in EDM numerical control system, it is proved that this technology is practical and reliable

keywords VxD interrupt EDM CNC system

abstract in "Zhang Ping, director of R & D department, said this paper, the principle of interrupt for Windows 95 is presented, and the method of handle activates various steel trade services g interrupt, which is based on VxD, is introduced It is demonstrated that this technology is reliable and useful in the application of NC for EDM.

1 preface

in recent years, the development of NC software on Windows 95 platform is the symbol and trend of NC product update. Using the rich resources of Windows 95, various menus and NC instruction software can be easily generated, and the product development cycle is short. Moreover, taking advantage of the characteristics of Windows 95 as a multi task operating system, it can also perform monitoring, fault diagnosis and other tasks to give full play to the performance of the host while ensuring that the foreground processing tasks are completed accurately and on time

at present, DOS system or 16 bit windows 3 is generally used as the operation platform of the control software of domestic NC EDM machine X system, and foreign companies such as arch company have adopted Windows 95 system as their control software platform, which greatly improves the functions of the software such as database and network, and the user's use effect is very good. In addition, there are many cad/cam software and other tool software based on Windows 95. In order to enhance the function of the control software, it is necessary to develop the control software of EDM numerical control system on Windows 95 platform

in fact, in the development of EDM numerical control system, it is often necessary to collect some status information in real time, transmit the signal to the host through the interface board, and the host receives the data through interruption to realize real-time measurement and control. Windows 95 is a message driven multi task environment. All kinds of messages are queued and processed according to the order of their arrival. The message mechanism does not distinguish the priority of tasks. If there is no interrupt setting, only the message mechanism can not ensure that the NC foreground control tasks can be executed in an accurate time. Therefore, in order to solve this problem, we must implement the interrupt processing of Windows 95

2 interrupt principle and implementation of Windows 95

about dos and 16 bit windows 3 There is a lot of information about the interrupt mechanism of X, which is relatively easy to implement and will not be repeated. This paper focuses on the interrupt principle of Windows 95, and briefly introduces its implementation method

as we all know, Intel's 80x86cpu series chips specify four levels of execution code reliability (i.e. ring 0 ~ 3), namely, level 0 and level 3 are only used in Windows 95. There are three kinds of fatigue analysis methods often used in the implementation of ring 0 Engineering: the code of nominal stress method, local stress-strain method and damage tolerance method, which can directly access the hardware. At present, 11000 enterprises nationwide have obtained the professional contracting qualification of steel structure engineering, interrupt and file system. Only the operating system and its components are allowed to be implemented within ring 0. The code of the application program is only executed within ring level 3 with the lowest reliability, and its ability to access memory outside the hardware and its own process space is limited

generally, there are two methods to realize interrupt under Windows 95, one is to write DLL program, the other is to use virtual device driver (VxD). The difference between the two is that VxD runs at ring 0 level as a component of the operating system, while DLL programs run at ring 3 level. In fact, VxD is also considered an executable DLL in 32-bit protected mode. It should be clear that VxD runs under the control of Virtual Machine Manager (VMM), which is the operating system component at the bottom (VMM includes all basic system functions, such as task scheduling, virtual memory operation, program loading and termination, inter task communication, etc., and is also responsible for handling major interrupts and exceptions). The hardware equipment sends interrupt signals after the data is ready, but VxD does not directly intercept these interrupt signals, but relies on the virtual programmable interrupt controller (vpicd) to interrupt the hardware. Vpicd can map hardware interrupts to other devices and provide services to other devices. These services allow virtual devices to request interrupts and simulate hardware interrupt signals in VMM. As the multitasking of Windows 95 system is realized through hardware virtualization, using this method to achieve high timing accuracy conforms to the principle of Windows 95 system itself, which is simple, convenient and conducive to the stability of Windows 95 system. See the figure below

vxd operation process diagram

therefore, at present, the high-precision real-time control under Windows 95 system is generally realized by writing VxD program. The methods to realize timing are as follows:

(1) adopt the API of virtual timer (vtdapi) provided by Windows system itself. The application must first get the entry address of vtdapi, then set the interrupt cycle through the function vtdapi begin int period, and finally start the timer with the function vtdapi start user timer to declare a callback function to be called by the cycle. It should be noted that 32 such timers can be registered in Windows 95 system

(2) using virtual timer device virtual hardware timer, provide other virtual devices to establish the interrupt rate service of the clock or capture the prohibition or opening of a given virtual device i/o port. First, set the system interrupt cycle through the function VTD begin min int period. Then, the timing device can be forced to disable or open the port through the functions VTD enable trapping and VTD disable trapping. Start the timer through the function set VM time out, and cooperate with the corresponding function to complete the required real-time control tasks. In fact, this method can also be used for external physical interrupts

to illustrate the interrupt control of virtual devices, first introduce a data structure, which is defined as follows:

structure vpicd IRQ descriptor{

Copyright © 2011 JIN SHI