资源描述:
《实时控制系统的步进电机速度控制器设计》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、湖北汽车工业学院科技学院KT1023-3ONION实时控制系统的步进电机速度控制器设计设计内容与要求:利用TPC-H通用微机接口实验箱设计一个实时控制系统的步进电机速度控制器。步进电机为四相,步距角为180/步,以单四拍方式运行。要求采用定时中断的方法控制步进电机的速度,转速在1~60r/min之间连续可调,具有正反转控制功能。程序如下:DATASEGMENTBUFFDW0H,0BB8H,05DCH,3E8H,2EEH,258H,1F4H,1ACH,177H,14DH,12CHDW110H,0FAH,0E6H,0D6H,0C8H,0BBH,0B0H,0A6H,9DH,9
2、6HDW8EH,88H,82H,7DH,78H,73H,6FH,6BH,67H,64HDW60H,5DH,5AH,58H,55H,53H,51H,4EH,4CH,4BHDW49H,47H,45H,44H,42H,41H,3FH,3EH,3DH,3CHDW3AH,39H,38H,37H,36H,35H,34H,33H,32H,32HBUFDW1HBUF2DB0DATAENDSSTAKSEGMENTSTA0DB128DUP(?)STAKENDSCODESEGMENTASSUMECS:CODE,DS:DATA,SS:STAKSTART:MOVAX,DATA;MOVDS,AX;
3、8255初始化MOVDX,240BH;288H~28FHMOVAL,10001011B;A口输出,C口输入OUTDX,AL;PA0-PA3控制电机的ABCD;PC7正反转,PC6脉冲,PC5-PC0共6个控时间;8253初始化;计数器0MOVDX,2403H;280H~287HMOVAL,00110110B;方式3OUTDX,ALMOVDX,2400HMOVAX,1000OUTDX,ALMOVAL,AHOUTDX,ALMOVBUF2,33H;A口输出初始值MOVBX,OFFSETBUFFMOVSI,0;计数器1方式0NEXT:MOVAX,BUFANDAX,3FHMOVS
4、I,AXSALSI,1MOVAX,[BX+SI]MOVBUF,AXMOVDX,2403H;280H~287HMOVAL,01110000BOUTDX,ALMOVDX,2401HMOVAX,BUFOUTDX,ALMOVAL,AHOUTDX,ALL0:MOVDX,240AHINAL,DXTESTAL,40HJNZL1JMPL0L1:TESTAL,80HJNZZZ;FZ:ANDAL,3FHCBWMOVBUF,AXMOVAL,BUF2RORAL,1;<-,PA3~PA0接A~DMOVBUF2,ALJMPSCZZZ:ANDAL,3FHCBWMOVBUF,AXMOVAL,BUF2R
5、OLAL,1;->,PA3~PA0接A~DMOVBUF2,ALSCZ:MOVDX,2408H;MOVAL,BUF2OUTDX,AL;A口最终的输出值;有按键就退出MOVAH,0BHINT21HCMPAL,0FFHJZEXITMOVAX,BUFCMPAL,1;最低速1r/minJBL3CMPAL,60;最高速60r/minJAL4JMPNEXTL3:MOVAX,1MOVBUF,AX;CALLASCIJMPNEXTL4:MOVAX,60MOVBUF,AX;CALLASCIJMPNEXT;退出EXIT:MOVAX,4C00HINT21HCODEENDSENDSTART