Driving a stepper motor with a LV8549MC

The bear

Senior Member
Hello Everyone,
I'm trying to drive a LV8549MC to operate a bipolar stepper motor.
The LV8549MC has two inputs plus an enable.
Experimental & learning only, not a project.
How do I get a good mark/space & the correct phase?

Any guidance would be appreciated, simple would be good.........
I'm monitoring the waveform on a 'scope.
Link for LV8549MC
http://www.onsemi.com/pub_link/Collateral/ENA2039-D.PDF

Code:
	;LV8549MC STEPPER DRIVER 06.07.16
	
	#Picaxe 08M2
	#No_Data
	
Main:

	do	low C.1
		 pause 5
		High C.2
		pause 160
		low C.2
		pause 20
		High C.1
		pause 150
		;low C.1
		;pause 10
	loop
	;	|'''|...|'''|...|
	;	  |'''|...|'''|...
	;Imagine the dots as a solid line
 
Last edited:

hippy

Technical Support
Staff member
Looking at page 5, with C.1 to IN1 and C.2 to IN2 I would have guessed

Code:
Do
  Low  C.1 : Low  C.2 : Pause 10
  High C.1 : Low  C.2 : Pause 10
  High C.1 : High C.2 : Pause 10
  Low  C.1 : High C.2 : Pause 10
loop
It is possible to optimise that -

Code:
Low C.1 : Low C.2
Do
  Toggle C.1 : Pause 10
  Toggle C.2 : Pause 10
  Toggle C.1 : Pause 10
  Toggle C.2 : Pause 10
loop
 

BESQUEUT

Senior Member
It is possible to optimise that -

Code:
Low C.1 : Low C.2
Do
  Toggle C.1 : Pause 10
  Toggle C.2 : Pause 10
  Toggle C.1 : Pause 10
  Toggle C.2 : Pause 10
loop
It is possible to optimise that -

Code:
Low C.1 : Low C.2
Do
  Toggle C.1 : Pause 10
  Toggle C.2 : Pause 10
loop
 

The bear

Senior Member
@BESQUEUT,
Thank you for that.
Now, how do I reverse the direction, without transposing the inputs to the LV8549MC ?
 

hippy

Technical Support
Staff member
It is possible to optimise that
Well spotted.

The DO-LOOP does add an extra bit of time to after the second TOGGLE. To keep the timing more consistent ...

Code:
Low C.1 : Low C.2
TogglePinC1: Toggle C.1 : Pause 10 : Goto TogglePinC2
TogglePinC2: Toggle C.2 : Pause 10 : Goto TogglePinC1
 

BESQUEUT

Senior Member
Well spotted.

The DO-LOOP does add an extra bit of time to after the second TOGGLE. To keep the timing more consistent ...
Why not :
Code:
Low C.1, C.2
Do
Toggle C.2 : pause 10
Toggle C.1 : pause 9
Loop
Try:
Code:
Low C.1, C.2
Do
Toggle C.2 : pause 10
Toggle C.1 : pause 10
Loop
What is the difference between civil and military alarm-clock ?





First one sound is : TIC TAC TIC TAC TIC TAC...
Second one : TAC TIC TAC TIC TAC TIC ...
 

hippy

Technical Support
Staff member
Why not ... pause 10 ... pause 9
The time for the LOOP is less than 1 ms so it just moves the discrepancy the other way. One could use PAUSEUS and tweak it until it matches so the principle is sound.

LOOP is basically just a GOTO back to the DO, so putting a GOTO after each should bring them more into balance. If a PAUSEUS doesn't slow the loop time down too much PAUSEUS could be added to each line to get their timing pretty close.
 

The bear

Senior Member
Thank you for all your help.
You make it look so simple, I did request simple, but never envisaged only five lines of code.

One happy bear...........
 
Top