Design and Implementation of PC-based CNC Software (2)


method one:

(a) Create a BMP map, which is then compressed into an RLE file named CNC.RLE;

(b) Execute the following command to form a new WIN.COM module:

COPY/B WIN.CNF +VGALOGO.LGO+CNC.RLE

(c) Restart Windows to see the new splash screen.

Method Two:

(a) Program a program for displaying graphics under DOS. The graphics can be in any format (*.bmp, *.gif, *.jpg, etc.), and select the graphics you want and like as the startup flag.

(b) Prepare a batch file, put the graphic display program in front, and put the Windows startup command Win/B behind (the /B option makes the startup flag not appear);

(c) Use the generated batch file instead of the original Windows startup command and run it.

. Implementation of multitasking scheduling

In our numerical control system, in order to achieve coordination and management between multiple tasks, we use non-preemptive multitasking scheduling and multi-buffering to achieve tasks that are not real-time (NC program input and decoding). , tool compensation, display, etc., the specific implementation method is:

(a) Specify a method for calculating the priority of each task (priority is not fixed);

(b) Establish a task queue and arrange the tasks that need to be completed currently. This queue does not consider the priority;

(c) Calculate the priority of each task and perform the task with the highest priority in each task cycle;

(d) Store the results of each task execution in multiple buffers and then perform the next homogeneous task.

In the numerical control system, the displayed task priority is always the lowest, while the other tasks have the same priority. Coordination by changing the priority of each task, although each task is executed with the highest priority, in fact, each task will be executed, and displayed without other tasks, can also be executed.

Multi-buffer implementation

In order to coordinate the operation between multiple tasks, multiple data buffers are created in the software. The specific implementation method is:

(a) allocate memory for the multi-buffer, establish a read and write pointer to the current buffer, and form a circular multi-buffer;

(b) Set a flag for each block of memory as a basis for judging the operation of each buffer;

(c) Each time a buffer is read, a read flag is set for the buffer, and the current read pointer is moved forward by a buffer;

(d) Each time a buffer is written, a write flag is set for the buffer, and the current write pointer is moved forward by a buffer;

(e) For the buffer whose current operation has not ended, set the operation flag to prohibit other operations.

In this way, the operation of the system that must be completed in a single interpolation cycle is "homogenized" in multiple interpolation cycles, effectively utilizing the computation time of the CPU, and improving the working efficiency of the system.

Previous page next page