AT89C2051驱动步进电机的电路和源码:AT89C2051驱动步进电机的电路和源码 程序:stepper.c stepper.hex/* * STEPPER.C * sweeping stepper's rotor cw and cww 400 steps * Copyright (c) 1999 by W.Sirichote */#i nclude c:\mc5151io.h /* include i/o header file */ #i nclude c:\mc5151reg.hregister unsigned char j,flag1,temp; register unsigned int cw_n,ccw_n;unsigned char step[8]={0x80,0xc0,0x40,0x60,0x20,0x30,0x10,0x90} #define n 400/* flag1 mask byte 0x01 run cw() 0x02 run ccw() */main(){ flag1=0; serinit(9600); disable(); /* no need timer interrupt */ cw_n = n; /* initial step number for cw */ flag1 |=0x01; /* initial enable cw() */while(1){ { tick_wait(); /* wait for 10ms elapsed */energize(); /* round-robin execution the following tasks every 10ms */ cw(); ccw(); } }}cw(){ if((flag1&0x01)!=0) { cw_n--; /* decrement cw step number */ if (cw_n !=0) j++; /* if not zero increment index j */ else {flag1&=~0x01; /* disable cw() execution */ ccw_n = n; /* reload step number to ccw counter */ flag1 |=0x02; /* enable cww() execution */ } }
上传时间: 2013-11-21
上传用户:boyaboy
51单片机驱动步进电机(含电路图和源程序代码) 源程序:stepper.c stepper.hex /* * STEPPER.C * sweeping stepper's rotor cw and cww 400 steps * Copyright (c) 1999 by W.Sirichote */ #i nclude c:\mc5151io.h /* include i/o header file */ #i nclude c:\mc5151reg.h register unsigned char j,flag1,temp; register unsigned int cw_n,ccw_n; unsigned char step[8]={0x80,0xc0,0x40,0x60,0x20,0x30,0x10,0x90} #define n 400 /* flag1 mask byte 0x01 run cw() 0x02 run ccw() */
上传时间: 2013-11-09
上传用户:钓鳌牧马
大总结L298N的详细资料驱动直流电机和步进电机
上传时间: 2014-01-01
上传用户:wangw7689
51单片机驱动步进电机电路及程序
上传时间: 2013-11-16
上传用户:924484786
AT89C2051驱动步进电机的电路和源码
上传时间: 2013-10-13
上传用户:tonyshao
步进电机驱动电路L297与L298以及原理分析
上传时间: 2013-10-13
上传用户:shen1230
ULN2003步进电机驱动原理及应用程序
上传时间: 2015-01-02
上传用户:wqxstar
步进电机电机驱动带细分驱动器
上传时间: 2013-10-31
上传用户:31633073
THB7128步进电机电机驱动带细分驱动器
上传时间: 2013-11-21
上传用户:yl8908
THB6064步进电机电机驱动带细分驱动器
上传时间: 2013-11-03
上传用户:asdkin