数控系统所支持的G代码一般是固定的.为了更好地支持数控系统G代码及其参数的扩展,基于可配置的思想设计和实现了数控解释器.通过分析数控程序的特点和解释器的工作过程定义了配置信息.设计了基于索引的位运算方法使得检查过程独立于具体的G代码.通过修改配置信息即可完成对扩展G代码和参数的获取和检查,这减少了扩展时的工作量,增强了系统的开放性和可扩展性.实现中将解释器分为词法语法分析模块和功能实现模块,模块化使解释器结构清晰,提高了代码的可重用性.%The G-Codes supported by CNC are generally fixed.To better support the extension of G-Code and its parameters,a CNC interpreter is designed and implemented based on configurable thought.Configuration information is defined through analyzing characteristics of CNC program and working procedure of interpreter.And an index-based bit operation method is designed,which makes the checking process independent of specific G-Code.The expanded G-Code and parameters can be obtained and checked by modifying configuration information,this reduces workload of expansion and enhances the openness and scalability of CNC.The interpreter is divided into lexical parsing module and function module in realization,modularization makes the structure of interpreter clear and enhances the reusability of the code.
展开▼