Shop OBEX P1 Docs P2 Docs Learn Events
Prop freezing with stepper — Parallax Forums

Prop freezing with stepper

CyrussCyruss Posts: 19
edited 2011-03-16 22:38 in Propeller 1
Hi Everyone.

Solved a problem with noise in the prop board a while ago. Now to my next problem :)

The problem i'm having is that the prop seams to freeze up when i'm running the stepper. Or better to say the stepper goes on by it self and the prop waits for it to be finished with it's process.

I tried to narrow it down by launching the stepper process on a separate cog and the in the main have a repeat loop looking for a button. It "felt" the button but the stepper just went on and on. And using a cogstop for that cog does not matter.

some of that code:
PRI BLINKA_11

flash := 11

testtest1 := 500

repeat
    
  DirA[flash] := Out
  Axis.MoveAbs(testtest1, True)
  OutA[flash] := High
  waitcnt(20_000_000 + cnt)
  OutA[flash] := Low
  waitcnt(20_000_000 + cnt)
  testtest1 := testtest1 + 500

It only turns on the diod at the beginning, and then the motor keeps on going slow in one direction.

I have a little movie clip of the motor when this happens. First i goes in one dir just fine and then starts in the other dir wrong and keeps going.

The code for that movie clip:
Axis.MoveAbs(2500, true)                              
  waitcnt(80_000_000 + cnt)                            
  Axis.MoveAbs(0, true)

I'm using the AxisDriver that i found on the Forum.

Any suggestions as to what this could be? If it's hardware based or code?

regards
/Lars

Comments

  • ElectricAyeElectricAye Posts: 4,561
    edited 2011-03-16 22:38
    I'm not familiar with AxisDriver, but it looks like your repeat loop is going to go on forever, right? And if MoveAbs means to move the stepper to an absolute position, then is it possible that because your testtest1 variable is always getting increased by 500, then the infinite repeat loop is always telling the motor to go another 500 steps? Where in your code can your demands ever be satisfied?

    Are your variables High and Low defined anywhere as 0 and 1?
Sign In or Register to comment.