- 8
- 0
- 约1.75万字
- 约 16页
- 2017-01-30 发布于北京
- 举报
(单片机控制步进电机转动程序
xxxxxxxxxxxxxxxxxxx
#include reg52.h
#include INTRINS.H
#include absacc.h
#include math.h
#define uint unsigned int
#define uchar unsigned char
#define ACC_LEVEL 42
#define DEC_LEVEL 42
#define STOP_LEVEL 42
#define UP_LEVEL (ACC_LEVEL-2)
#define DOWN_LEVEL 1
uchar code slave_addr[4]={00, 01, 02, 255};
uchar code c1[10]={0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xA0,0xA2};
uchar code c2[10]={0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF,0xB0,0xB2};
/*加速过程各档速度定时器初值,用16位的T2实现*/
uint code acc_pulse_T2_const[ACC_LEVEL]=
{64170,64170,64841,65065,65176,65243,6528
原创力文档

文档评论(0)