标签:signed ++ clu bsp include main 方向 变量 顺时针
#include<reg52.h>
unsigned char code Frea[]={ //步进机节拍方向的IO口
//逆时针转动
//0x0e,0x0c,0x0d,0x09,0x0b,0x03,0x07,0x06
//顺时针转动
0x06, 0x07,0x03,0x0b,0x09,0x0d, 0x0c,0x0e
};
void delay(){
unsigned char i=200;
while(i--);
}
void main(){
unsigned char tmp; //暂存变量
unsigned char index = 0; //节拍调用索引
while(1){
tmp = P1; //绑定P1口
tmp = tmp & 0xf0; //清零低四位
tmp = tmp | Frea[index]; //节拍或f赋值
P1 = tmp; //绑定步进机IO口
index++;
index = index & 0x07;
delay();
}
}
标签:signed ++ clu bsp include main 方向 变量 顺时针
原文地址:http://www.cnblogs.com/robotes/p/7689368.html