In the process of multi axis machine tool, sometimes it is necessary to switch between the rotating spindle and the rotary feed shaft. In order to satisfy the request mentioned above, this article makes a brief introduction to the upper software and analyzes the control principle of spindle by using PMAC, combined with that, a method to deliver the automatic switching function between spindle mode and C-axis mode has been put forward, which has already used in the independent R&D project single-point diamond ultra-precision CNC system. In addition, on the basis of this method, a more advanced function called constant linear speed mode will be explored, which can both ensure the quality of workpiece and improving efficiency enormously.