In the designation of software , the author adopts the modular designing method , and makes full use of the functions what the mcu offers , such as a / d function , interrupt function , pwm function , and software timer function . as a result , the following subroutines are programmed : a / d sample , read optic - electron coder signal , disposition of orientation interruption , z interruption , and software timer 在控制软件的设计上,采用模块化程序设计方法,充分利用单片机内部提供的a d功能、中断功能、 pwm功能、软件定时器等功能,设计出了a d采样子程序、读编码器信号子程序、定位中断服务子程序、 z中断服务子程序、软件定时器中断服务子程序等模块化程序。