找回密码
 立即注册
楼主: 梁工

51开源,步进电机驱动 程序, 直接驱动, 或驱动步进电机驱动器 一共8个程序

 火.. [复制链接]

83

主题

8216

回帖

1万

积分

超级版主

积分
17634
 楼主| 发表于 2026-7-17 10:04:03 | 显示全部楼层
Hell0*** 发表于 2026-7-17 08:45
程序可以移植到89c52上面吗

89C52只能使用定时器。
回复

使用道具 举报 送花

10

主题

125

回帖

3533

积分

论坛元老

积分
3533
发表于 2026-7-19 00:33:56 | 显示全部楼层
Hell0*** 发表于 2026-7-17 10:02
你也做过这个吗,可以发例程吗谢谢

可以的,互相学习
回复

使用道具 举报 送花

10

主题

125

回帖

3533

积分

论坛元老

积分
3533
发表于 2026-7-19 00:41:05 | 显示全部楼层
Wd*** 发表于 2026-7-19 00:33
可以的,互相学习

我这写的比较LOW,见笑了,
// 电机转动一步函数
void Step_Motor(Motor_Pins *motor_pins, unsigned int delay_time) {
    static unsigned char num = 0;
    switch (num) {
    case 0:
        motor_pins->A = 1;
        motor_pins->B = 0;
        motor_pins->C = 0;
        motor_pins->D = 0;
        break;
    case 1:
        motor_pins->A = 1;
        motor_pins->B = 1;
        motor_pins->C = 0;
        motor_pins->D = 0;
        break;
    case 2:
        motor_pins->A = 0;
        motor_pins->B = 1;
        motor_pins->C = 0;
        motor_pins->D = 0;
        break;
    case 3:
        motor_pins->A = 0;
        motor_pins->B = 1;
        motor_pins->C = 1;
        motor_pins->D = 0;
        break;
    case 4:
        motor_pins->A = 0;
        motor_pins->B = 0;
        motor_pins->C = 1;
        motor_pins->D = 0;
        break;
    case 5:
        motor_pins->A = 0;
        motor_pins->B = 0;
        motor_pins->C = 1;
        motor_pins->D = 1;
        break;
    case 6:
        motor_pins->A = 0;
        motor_pins->B = 0;
        motor_pins->C = 0;
        motor_pins->D = 1;
        break;
    case 7:
        motor_pins->A = 1;
        motor_pins->B = 0;
        motor_pins->C = 0;
        motor_pins->D = 1;
        break;
    }
    num++;
    if (num == 8) {
        num = 0;
    }
    Delay_ms(delay_time);
}
回复

使用道具 举报 送花

已绑定手机

3

主题

33

回帖

167

积分

注册会员

积分
167
发表于 2026-7-19 08:27:29 | 显示全部楼层
Wd*** 发表于 2026-7-19 00:33
可以的,互相学习

谢谢我试试
回复

使用道具 举报 送花

54

主题

397

回帖

860

积分

高级会员

积分
860
发表于 2026-8-13 09:13:43 | 显示全部楼层
晚点学习一下
回复

使用道具 举报 送花

已绑定手机

0

主题

72

回帖

895

积分

高级会员

积分
895
发表于 2026-8-26 23:47:15 | 显示全部楼层
回复

使用道具 举报 送花

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|深圳国芯人工智能有限公司 ( 粤ICP备2022108929号-2 )

GMT+8, 2026-9-22 06:54 , Processed in 0.070922 second(s), 68 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表