Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20606

Share your working BASCOM-AVR code here : Steppermotor driver A4988 : NEWTOPIC

$
0
0
No rocket science, driving a steppermotor with a A4988 stepstick [img:d2d2097d8d]http://members.home.nl/hobbycorner/images/prusa/a4988.jpg[/img:d2d2097d8d] And you can plug four of them in a Sanguinololu board [img:d2d2097d8d]http://members.home.nl/hobbycorner/images/prusa/sanguinololu_stepper_A4988.jpg[/img:d2d2097d8d] And use this program to drive the steppermotor [code:1:d2d2097d8d]$regfile "m1284pdef.dat" $crystal = 16000000 $baud = 115200 $hwstack = 64 $swstack = 64 $framesize = 64 'A4988 steppermotor drivers X_step Alias Portd.7 X_dir Alias Portc.5 'step enable Step_enable Alias Portd.6 Config X_step = Output Config X_dir = Output Config Step_enable = Output Dim Count As Word Print "Start program" Reset Step_enable Do Print "CCW" Set X_dir For Count = 1 To 3200 Set X_step Waitms 1 Reset X_step Waitms 1 Next Count Print "CW" Reset X_dir For Count = 1 To 3200 Set X_step Waitus 40 Reset X_step Waitus 40 Next Count Loop End[/code:1:d2d2097d8d] With a jumper on MS1, MS2 and MS3 you make a 16th step, 3200 steps for a full rotation. Highest speed with a duty cycle of 40 uS. Have fun Ben Zijlstra

Viewing all articles
Browse latest Browse all 20606

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>