View previous topic :: View next topic |
Author |
Message |
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Wed May 13, 2020 5:57 am |
|
|
Both those stepper chips have 3 pins for 'microstepping' and you're not setting them so the chip is always in full step mode.
while I don't have either device it seems that ....
code like ...
...
select step size ( set M1,M2,M3 pins) [say using 'SWITCH']
issue 'step command to step'
...
should work...
Others who use these devices will have real World knowledge, I'm just reading the datasheets... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19540
|
|
Posted: Wed May 13, 2020 6:13 am |
|
|
The key thing is your existing code uses delay_ms between steps. Even
if the value is '1' for this, it limits your maximum step rate to just 1000*sec.
The code posted is instead using a timer interrupt at 25KHz for the minimum
step interval....
If you have a 400step motor, and you are using say 16* microstepping
(generally there is little reason to ever go beyond this - only special motors
have enough accuracy on the magnets to give worthwhile working beyond
this), then to do (say) 200RPM, you need a step pulse rate of:
(200*400*16)/60 = 21333Hz.
at 1000Hz, you can only get to about 20RPM.
In fact looking at it you use two delay_ms calls, so 10RPM.
The stepper controller should only require a pulse of perhaps 1uSec (not
mSec), and the repeat frequency of this will need to go up to tens
of kHz if you want to move the motor quickly..... |
|
|
mednas
Joined: 09 May 2020 Posts: 7 Location: Algeria
|
|
Posted: Wed May 13, 2020 11:41 am |
|
|
The 3 pins in the driver to select the mode M1, M2 and M3 are connected to 3 interruptors i can select full step mode the 3 pins connected to GND and 1/16 microstep the 3 pins to VCC. My code work only for full step. I have to change delay to us for microsteps.
BTW i have tested the code of the link shared by Ttelmah it work fine with timer 25khz, this what i want. I will add some lines to use uart and receive data from uart and show it in lcd.
Thank you guys _________________ ''I never lose, I either win or learn!" Nelson Mandela |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19540
|
|
Posted: Wed May 13, 2020 12:44 pm |
|
|
Good.
Change the title of the thread, to include [Solved] please. |
|
|
|