Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Steppermotor driver A4988

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Share your working BASCOM-AVR code here
View previous topic :: View next topic  
Author Message
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Mon Dec 02, 2013 9:55 pm    Post subject: Steppermotor driver A4988 Reply with quote

No rocket science, driving a steppermotor with a A4988 stepstick



And you can plug four of them in a Sanguinololu board



And use this program to drive the steppermotor

Code:
$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


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 80 uS.

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 4392
Location: Holland

blank.gif
PostPosted: Mon Dec 02, 2013 11:38 pm    Post subject: Reply with quote

thanks for sharing Ben. That is a convenient chip. Always good to have simple code to get things started Smile
_________________
Best regards,

Mark Alberts
MCS Electronics

http://www.mcselec.com
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Share your working BASCOM-AVR code here All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum