www.pudn.com > steper8.zip > STEP_MOT.c, change:2008-10-10,size:671b


///步进电机实验 
 
#include "DSP28_Device.h" 
 
const Uint16 Backward[]={0x0c,0x08,0x18,0x10,0x30,0x20,0x24}; 
const Uint16 StopCtrl=0x00; 
 
void Delay(Uint16); 
 
void main(void) 
{ 
	unsigned int i; 
	 
	InitSysCtrl();			//初始化系统 
 
	DINT;				//关中断 
	IER = 0x0000; 
	IFR = 0x0000; 
 
	InitPieCtrl();			//初始化PIE控制寄存器 
	InitPieVectTable();		//初始化PIE矢量表 
	InitGpio();			//初始化GPIO 
	 
	EINT; 
	ERTM; 
 
	for(;;) 
	{ 
		for(i=0;i<8;i++) 
		{ 
			GpioDataRegs.GPADAT.all=Backward[i]; 
			Delay(300); 
		} 
	} 
} 	 
 
 
void Delay(Uint16  data)			//延时函数 
{ 
	Uint16	i; 
	int   k; 
	for (i=0;i<data;i++)  
	{ 
		for(k=0;k<20;k++) 
		{	;	} 
	}	 
}