对中断定时器一知半解, 抄袭了下面的程序, 怎么修改成能够修改成加速步进电机
#include <reg52.h>
unsigned char code F_Rotation[]={0x01,0x05,0x04,0x06,0x02,0x0a,0x08,0x09};
main() { TMOD |=0x01; //定时器设置 1ms in 12M crystal IE= 0x82; //打开中断 ET0 = 1; TR0=1; while(1) { } } void Timer0(void) interrupt 1 using 1 { static unsigned char Cnt;
TH0=(65536-55000)/256; TL0=(65536-55000)%256; if(Cnt<8) Cnt++; else Cnt=0; P3=F_Rotation[Cnt]; } |