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()
*/