Shop OBEX P1 Docs P2 Docs Learn Events
Motor accel and decel attemp — Parallax Forums

Motor accel and decel attemp

T ChapT Chap Posts: 4,217
edited 2006-06-12 18:49 in BASIC Stamp
I was serching for a method to change the PAUSE value on the fly, and so I just tried this:

MOTOR VAR OUTA
COUNTER VAR BYTE
PauseTime VAR BYTE
PulseCount VAR WORD
But1 VAR IN4

PulseCount = 0 'Zero out PulseCount

MAIN:
PauseTime = 255
motor = %0000

WaitState:
motor = %0000
IF But1 = 1 THEN CheckPulseCount
GOTO WaitState

CheckPulseCount:
IF PulseCount = 0 THEN Position1
IF PulseCount = 1000 THEN Position2


The reset of the code is attached if any would look at it. I am testing this code with LEDS for now and it seems to do the trick for ramping a motor up into its speed and then ramping it back down to the destination.

There are several things I'd like to solve though.

1. Is there a way to create a "curve" for the accel/decel, rather than the straight line I have now? I am sure there are formulas for such, but how to impliment a formula in the method above?

2. Is there a way to external enter the speed and curve without a PC attached? I was thinking that for the speed it would be easy to set for eample INA VAR NIB, and the input could be a rotary encoder or 4 toggle switches that set the speed, but that limits you to setting speed for all positions only, not individually. Ideally I'd like to be able to set speed and accel and decel curves individually, externally without a PC, and have it get stored in memory. A last resort would be a stand alone PC application, that could be connected with serial cable, then the info sent over.

Comments

  • WigginsWiggins Posts: 2
    edited 2006-06-12 18:49
    What do you mean by "Change the Pause value on the Fly". Do you mean being able to adjust it with an external controller?
Sign In or Register to comment.