Shop OBEX P1 Docs P2 Docs Learn Events
help: senior project — Parallax Forums

help: senior project

chamcham Posts: 2
edited 2004-12-06 21:03 in BASIC Stamp
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
688 x 427 - 21K

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-06 16:15
    What are the specs on your motor? Do you have it connected correctly (I suspect not)? You can help others help you by attaching the tech docs for your motor to you post.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • steve_bsteve_b Posts: 1,563
    edited 2004-12-06 18:24
    Is stpDelay=15 big enough?

    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."

  • chamcham Posts: 2
    edited 2004-12-06 18:46
    I suspect that we connected the circuit incorrectly but we've went over it quite a few times and the logic appears to be correct. here is the link to spec sheet for the motor:
    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
  • steve_bsteve_b Posts: 1,563
    edited 2004-12-06 18:58
    a nice option of this forum is creating clickable http links.· It's a little easier for those following along! wink.gif

    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."

  • dlborgmandlborgman Posts: 11
    edited 2004-12-06 20:02
    cham, spotted a couple of things for you to try.
    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 WilliamsJon Williams Posts: 6,491
    edited 2004-12-06 21:03
    PBASIC initializes all variables to zero, so the extra step is not required.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
Sign In or Register to comment.