步进电机角度控制.docx

步进电机角度控制 1.编程控制步进电机顺时针行走, 180度(角度显示在七段 LED 上),3 秒后行走 45度(显 示角度),3 秒后行走 90 度(显示角度) ,3 秒后行走 180 度,依次循环。 #include conio.h #define uchar unsigned char #define uint unsigned int #define PA 0x60 #define PB 0x61 #define PC 0x62 #define CTRL 0x63 uchar pai[]={0x01,0x03,0x02,0x06,0x04,0x0c,0x08,0x09}; uchar teble[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07, 0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71}; uint m=0; uchar a3,a2,a1,a0=0; void delay(uint xms) { uint i,j; for(i=xms;i0;i--){ for(j=110;j0;j--);} } void display() { outp(PA,teble[a0]); outp(PB,0x07); delay(10); outp(PA,teble[a1]); outp(PB,0x0b); delay

文档评论(0)

1亿VIP精品文档

相关文档