简体   繁体   English

步进电机C实现

[英]Stepper motor C Implementation

Been unsuccessful in finding this answer elsewhere.在其他地方找不到这个答案没有成功。

Is there a typical way to implement stepper motor, Accel, velocity and speed control in C?在 C 中是否有实现步进电机、加速度、速度和速度控制的典型方法?

The clock speed doesn't seem quick enough to toggle a step pin each loop.时钟速度似乎不够快,无法在每个循环中切换一个步进引脚。 Do people normally use a CTC interrupt and change the timer compare value?人们通常会使用 CTC 中断并更改定时器比较值吗? I want to move a certain amount of steps at a definable Vel and Accel.我想以可定义的 Vel 和 Accel 移动一定数量的步数。

Any help would be greatly appreciated!任何帮助将不胜感激!

Oppy欧皮

Time ago I wrote a C device driver on an STM8S microcontroller for a 24 VDC Sonceboz stepper motor.前段时间,我在 STM8S 微控制器上为 24 VDC Sonceboz 步进电机编写了 C 设备驱动程序。

Between the CPU and the motor I put an L6219 stepper motor driver.在 CPU 和电机之间,我放置了一个 L6219 步进电机驱动器。

The CPU clock was 8 MHz. CPU 时钟为 8 MHz。

I used a hardware timer that every 10 ms fired an interrupt.我使用了一个硬件定时器,它每 10 毫秒触发一次中断。

Within the interrupt function there was my code that drove the L6219 driver.在中断 function 中有我的代码驱动 L6219 驱动程序。

The CPU time spent in the interrupt function was less than 20 micro seconds.中断 function 花费的 CPU 时间不到 20 微秒。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM