help: senior project
cham
Posts: 2
I am using a Prortescap 55M048D2U stepper motor. I am trying to test it out by revolving the motor 360 degrees. It does not make one revolution. It jerks foward and backwards. Attached is a circuit diagram I used to connect the motor to the board·and a source listing of my code. I am not sure what I am doing wrong. Please help!
Thanks
'
[noparse][[/noparse] I/O Definitions ]
Phase·········· VAR···· OUTB··················· ' phase control outputs
'
[noparse][[/noparse] Constants ]
'
[noparse][[/noparse] Variables ]
idx············ VAR···· Byte··················· ' loop counter
stpIdx········· VAR···· Nib···················· ' step pointer
stpDelay······· VAR···· Byte··················· ' delay for speed control
'
[noparse][[/noparse] EEPROM Data ]
Steps·········· DATA··· %0011, %0110, %1100, %1001
'
[noparse][[/noparse] Initialization ]
Setup:
· DIRB = %1111································· ' make P4..P7 outputs
· stpDelay = 15································ ' set step delay
'
[noparse][[/noparse] Program Code ]
Main:
· FOR idx = 1 TO 100···························· ' one revolution
··· GOSUB Step_Fwd····························· ' rotate clockwise
· NEXT
· PAUSE 500···································· ' wait 1/2 second
· FOR idx = 1 TO 48···························· ' one revolution
··· GOSUB Step_Rev····························· ' rotate counter-clockwise
· NEXT
· PAUSE 500···································· ' wait 1/2 second
· GOTO Main
· END
'
[noparse][[/noparse] Subroutines ]
' Turn stepper clockwise one full step (7.5 degrees)
Step_Fwd:
· stpIdx = stpIdx + 1 // 4····················· ' point to next step
· GOTO Do_Step
' Turn stepper counter-clockwise one full step (7.5 degrees)
Step_Rev:
· stpIdx = stpIdx + 3 // 4····················· ' point to previous step
· GOTO Do_Step
' Read new step data and output to pins
Do_Step:
· READ (Steps + stpIdx), Phase················· ' output new phase data
· PAUSE stpDelay······························· ' pause between steps
· RETURN
Thanks
'
[noparse][[/noparse] I/O Definitions ]
Phase·········· VAR···· OUTB··················· ' phase control outputs
'
[noparse][[/noparse] Constants ]
'
[noparse][[/noparse] Variables ]
idx············ VAR···· Byte··················· ' loop counter
stpIdx········· VAR···· Nib···················· ' step pointer
stpDelay······· VAR···· Byte··················· ' delay for speed control
'
[noparse][[/noparse] EEPROM Data ]
Steps·········· DATA··· %0011, %0110, %1100, %1001
'
[noparse][[/noparse] Initialization ]
Setup:
· DIRB = %1111································· ' make P4..P7 outputs
· stpDelay = 15································ ' set step delay
'
[noparse][[/noparse] Program Code ]
Main:
· FOR idx = 1 TO 100···························· ' one revolution
··· GOSUB Step_Fwd····························· ' rotate clockwise
· NEXT
· PAUSE 500···································· ' wait 1/2 second
· FOR idx = 1 TO 48···························· ' one revolution
··· GOSUB Step_Rev····························· ' rotate counter-clockwise
· NEXT
· PAUSE 500···································· ' wait 1/2 second
· GOTO Main
· END
'
[noparse][[/noparse] Subroutines ]
' Turn stepper clockwise one full step (7.5 degrees)
Step_Fwd:
· stpIdx = stpIdx + 1 // 4····················· ' point to next step
· GOTO Do_Step
' Turn stepper counter-clockwise one full step (7.5 degrees)
Step_Rev:
· stpIdx = stpIdx + 3 // 4····················· ' point to previous step
· GOTO Do_Step
' Read new step data and output to pins
Do_Step:
· READ (Steps + stpIdx), Phase················· ' output new phase data
· PAUSE stpDelay······························· ' pause between steps
· RETURN
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
I know I had issues with my pause (delay) statement in my program and I sorted it out after realizing that I wasn't pausing long enough.
You're pauses in between your CW and CCW functions seem about a good number in between pulses.
Dunno, not an expert....just offering what I've encountered!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Steve
http://members.rogers.com/steve.brady
http://www.geocities.com/paulsopenstage
"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
http://www.portescap.com/Sections/Products/products_main.asp?PC=10107201&CL=6&L1=10000000&L2=10015000&L3=10100000&L4=10107000&L5=10107200&L6=10107201&IT=Catalogs&lang=1
Did you try increasing your StpDelay?
I couldn't find mention of it in your link to the motor.
Maybe rem out the parts calling for it to go in reverse....rem out the pause 500 as well.
Does it go CW at all?· take off the REM on the pause 500....is it moving now?
Just curious.
Also, REM'ing out a line is achieved by an apostrophe '··
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Steve
http://members.rogers.com/steve.brady
http://www.geocities.com/paulsopenstage
"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
You never initialize stpIdx to zero at the start of your program,
so you may have a goofy startup value there.
The motor reference you point to has a wiring schematic and step
table. The table there doesn't match what you have in "data".
Try 0101, 0110, 1010, 1001 as the four step binary data.
You may have to invert these values to output 0 volts for
the "1"s.
In your first loop, you iterate 100 times. That's 2 revolutions
plus four steps. Your comment says go one rev. (48 steps)
The other suggestions for increasing delays may be help so you
can "see" what is happening for each step. You may also want
to sent the step value read from data back to the terminal to
help you see if you are addressing the data properly.
Dennis
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office