Searching \ for 'Stepper code sample for half step- Strange stepper' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: piclist.com/techref/io/steppers.htm?key=stepper
Search entire site for: 'Stepper code sample for half step- Strange stepper'.

Truncated match.
PICList Thread
'Stepper code sample for half step- Strange stepper'
1999\09\20@141757 by Jon Petty

picon face
Hi everyone

I downloaded the following code to a 16c509 jw chip, which controls a stepper
based on a couple of buttons, figured out the wires on my stepper (with help
from the list), hooked everything up and the stepper displays strange
behavior. Sometimes it will turn 1/2 rev then stop and quiver. I accidentally
found that if it would only turn if the wire  leads coming out of the motor
were coiled 180 deg around the motor. When I would hold the shaft and
depress the button the motor would turn, unwind the leads then stop a quiver.
If I put the leads straight it the motor will just quiver. I checked the
connections and 3 other motors that all exhibited this behavior.

I am using a ULN 2803 to drive the stepper. ANy ideas?

The code I used is designed to half step ther stepper.
http://www.beowulf.demon.co.uk.
The stepper I am using is unipolar, two phase, 6 lead, 12v, 15 deg per step


My question is, are all motors capable of half stepping?
What else could be causing this behavior?
Can I change the lookup table to get full steps?



; control a small stepper motor with a 12c509

; There are two controls, run/stop and direction.
; The motor steps when the RUN button is depressed.
; If the DIRECTION button is pressed the direction
; of rotation is reversed.

;
; Peter Lynch, 13 May 1998
; spam_OUTpicTakeThisOuTspambeowulf.demon.co.uk

; (this code is NOT certified Year 2000 compliant)

       LIST P=12c509

   include "\mplab\P12c509.inc"

OPMASK  EQU B'11000000'
BMASK   EQU B'00101000' ; all bits output (except GP3 and 5)
                               ; GP3 controls run/stop
                               ; GP5 controls direction

RUN_BTN EQU 3
DIR_BTN EQU 5

DELAY1  EQU 0C
DELAY2  EQU 0D

INDEX   EQU 0E      ; step index

   ORG 0

; start of main code

   MOVWF   OSCCAL

   MOVLW   OPMASK
   OPTION

   MOVLW   BMASK
   TRIS    GPIO


; now go into a loop, output the next bit pattern on
; GP0 - GP4 (GP3 is input only)

   CLRF    INDEX
NEXT

; check for the run/stop button

   BTFSS   GPIO, RUN_BTN
   GOTO    NEXT

   BTFSS   GPIO,DIR_BTN
   GOTO    CWISE

   INCF    INDEX, W
   GOTO    NEW_IDX
CWISE
   DECF    INDEX, W
NEW_IDX
   ANDLW   .7
   MOVWF   INDEX

; here W contains the index (either incremented or decremented, depending
; on the direction switch) into the array for the new stepper actuations

   CALL    STEP        ; convert the index into a bit pattern
   MOVWF   GPIO
   CALL    DELAY

   GOTO    NEXT


; routine to get step index

STEP
   ADDWF   PCL, F
   RETLW   B'00000001'
   RETLW   B'00000101'
   RETLW   B'00000100'
   RETLW   B'00000110'
   RETLW   B'00000010'
   RETLW   B'00010010'
   RETLW   B'00010000'
   RETLW   B'00010001'


; routine to delay between steps

DELAY

   MOVLW   .10     ; 10 mSec per step
   MOVWF   DELAY1
DEL_0
   MOVLW   .250        ; 1 millisecond delay
   MOVWF   DELAY2

DEL_1

   NOP
   DECFSZ  DELAY2, F
   GOTO    DEL_1

   DECFSZ  DELAY1, F
   GOTO    DEL_0

   RETURN

   END

1999\09\20@160830 by l.allen

picon face
> from the list), hooked everything up and the stepper displays strange
> behavior. Sometimes it will turn 1/2 rev then stop and quiver. I accidentally
> found that if it would only turn if the wire  leads coming out of the motor
> were coiled 180 deg around the motor. When I would hold the shaft and
> depress the button the motor would turn, unwind the leads then stop a quiver.
> If I put the leads straight it the motor will just quiver. I checked the
> connections and 3 other motors that all exhibited this behavior.
>
> I am using a ULN 2803 to drive the stepper. ANy ideas?
>
> The code I used is designed to half step ther stepper.
> http://www.beowulf.demon.co.uk.
> The stepper I am using is unipolar, two phase, 6 lead, 12v, 15 deg per step
>
>
> My question is, are all motors capable of half stepping?
> What else could be causing this behavior?
> Can I change the lookup table to get full steps?
>
>
The fact that the behaviour alters with wire orientation strongly
suggests hardware problems.
Is the FreeWheel pin on the ULN2803 connected to the motor VCC?
Is there sufficient power supply decoupling?.. try a BIG cap
(10,000uF per AMP) across the motor supply and / or PIC supply.
Coiling the leads around the motor sounds like adding inductance.. a
low pass filter is being created in the wires.Reinforcing my
suggestions of ULN 2803 freewheel pin and big caps.

_____________________________

Lance Allen
Technical Officer
Uni of Auckland
Psych Dept
New Zealand
_____________________________

1999\09\20@185150 by Jon Petty

picon face
part 0 6494 bytes content-type:text/plain; charset="us-ascii" (decoded 7bit)

I downloaded the following code to a 16c509 jw chip, which controls a
stepper based on a couple of buttons, figured out the wires on my stepper
(with help from the list), hooked everything up and the stepper displays
strange behavior. Sometimes it will turn 1/2 rev then stop and quiver. I
accidentally found that if it would only turn if the wire  leads coming out
of the motor were coiled 180 deg around the motor. When I would hold the
shaft and  depress the button the motor would turn, unwind the leads then
stop a quiver. If I put the leads straight it the motor will just quiver. I
checked the connections and 3 other motors that all exhibited this behavior.

I am using a ULN 2803 to drive the stepper. ANy ideas?

The code I used is designed to half step ther stepper.
http://www.beowulf.demon.co.uk.
The stepper I am using is unipolar, two phase, 6 lead, 12v, 15 deg per step


My question is, are all motors capable of half stepping?
What else could be causing this behavior?
Can I change the lookup table to get full steps?



; control a small stepper motor with a 12c509

; There are two controls, run/stop and direction.
; The motor steps when the RUN button is depressed.
; If the DIRECTION button is pressed the direction
; of rotation is reversed.

;
; Peter Lynch, 13 May 1998
; .....picKILLspamspam@spam@beowulf.demon.co.uk

; (this code is NOT certified Year 2000 compliant)

       LIST P=12c509

   include "\mplab\P12c509.inc"

OPMASK EQU B'11000000'
BMASK  EQU B'00101000' ; all bits output (except GP3 and 5)
                                ; GP3 controls run/stop
                                ; GP5 controls direction

RUN_BTN    EQU 3
DIR_BTN    EQU 5

DELAY1 EQU 0C
DELAY2 EQU 0D

INDEX  EQU 0E      ; step index

   ORG 0

; start of main code

   MOVWF   OSCCAL

   MOVLW   OPMASK
   OPTION

   MOVLW   BMASK
   TRIS    GPIO


; now go into a loop, output the next bit pattern on
; GP0 - GP4 (GP3 is input only)

   CLRF    INDEX
NEXT

; check for the run/stop button

   BTFSS   GPIO, RUN_BTN
   GOTO    NEXT

   BTFSS   GPIO,DIR_BTN
   GOTO    CWISE

   INCF    INDEX, W
   GOTO    NEW_IDX
CWISE
   DECF    INDEX, W
NEW_IDX
   ANDLW   .7
   MOVWF   INDEX

; here W contains the index (either incremented or decremented, depending
; on the direction switch) into the array for the new stepper actuations

   CALL    STEP        ; convert the index into a bit pattern
   MOVWF   GPIO
   CALL    DELAY

   GOTO    NEXT


; routine to get step index

STEP
   ADDWF   PCL, F
   RETLW   B'00000001'
   RETLW   B'00000101'
   RETLW   B'00000100'
   RETLW   B'00000110'
   RETLW   B'00000010'
   RETLW   B'00010010'
   RETLW   B'00010000'
   RETLW   B'00010001'


; routine to delay between steps

DELAY

   MOVLW   .10     ; 10 mSec per step
   MOVWF   DELAY1
DEL_0
   MOVLW   .250        ; 1 millisecond delay
   MOVWF   DELAY2

DEL_1

   NOP
   DECFSZ  DELAY2, F
   GOTO    DEL_1

   DECFSZ  DELAY1, F
   GOTO    DEL_0

   RETURN

   END
 >>


Return-path: Phxsys3spamKILLspamaol.com
From: .....Phxsys3KILLspamspam.....aol.com
Full-name: Phxsys3
Message-ID: <EraseME8de0765d.2517d3fespam_OUTspamTakeThisOuTaol.com>
Date: Mon, 20 Sep 1999 14:16:30 EDT
Subject: Stepper code sample for half step- Strange stepper behavior
To: PICLISTspamspam_OUTmitvma.mit.edu, @spam@PHXSYSKILLspamspamaol.com
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: AOL 4.0 for Windows 95 sub 26

Hi everyone

I downloaded the following code to a 16c509 jw chip, which controls a stepper
based on a couple of buttons, figured out the wires on my stepper (with help
from the list), hooked everything up and the stepper displays strange
behavior. Sometimes it will turn 1/2 rev then stop and quiver. I accidentally
found that if it would only turn if the wire  leads coming out of the motor
were coiled 180 deg around the motor. When I would hold the shaft and
depress the button the motor would turn, unwind the leads then stop a quiver.
If I put the leads straight it the motor will just quiver. I checked the
connections and 3 other motors that all exhibited this behavior.

I am using a ULN 2803 to drive the stepper. ANy ideas?

The code I used is designed to half step ther stepper.
http://www.beowulf.demon.co.uk.
The stepper I am using is unipolar, two phase, 6 lead, 12v, 15 deg per step


My question is, are all motors capable of half stepping?
What else could be causing this behavior?
Can I change the lookup table to get full steps?



; control a small stepper motor with a 12c509

; There are two controls, run/stop and direction.
; The motor steps when the RUN button is depressed.
; If the DIRECTION button is pressed the direction
; of rotation is reversed.

;
; Peter Lynch, 13 May 1998
; KILLspampicKILLspamspambeowulf.demon.co.uk

; (this code is NOT certified Year 2000 compliant)

       LIST P=12c509

   include "\mplab\P12c509.inc"

OPMASK  EQU B'11000000'
BMASK   EQU B'00101000' ; all bits output (except GP3 and 5)
                               ; GP3 controls run/stop
                               ; GP5 controls direction

RUN_BTN EQU 3
DIR_BTN EQU 5

DELAY1  EQU 0C
DELAY2  EQU 0D

INDEX   EQU 0E      ; step index

   ORG 0

; start of main code

   MOVWF   OSCCAL

   MOVLW   OPMASK
   OPTION

   MOVLW   BMASK
   TRIS    GPIO


; now go into a loop, output the next bit pattern on
; GP0 - GP4 (GP3 is input only)

   CLRF    INDEX
NEXT

; check for the run/stop button

   BTFSS   GPIO, RUN_BTN
   GOTO    NEXT

   BTFSS   GPIO,DIR_BTN
   GOTO    CWISE

   INCF    INDEX, W
   GOTO    NEW_IDX
CWISE
   DECF    INDEX, W
NEW_IDX
   ANDLW   .7
   MOVWF   INDEX

; here W contains the index (either incremented or decremented, depending
; on the direction switch) into the array for the new stepper actuations

   CALL    STEP        ; convert the index into a bit pattern
   MOVWF   GPIO
   CALL    DELAY

   GOTO    NEXT


; routine to get step index

STEP
   ADDWF   PCL, F
   RETLW   B'00000001'
   RETLW   B'00000101'
   RETLW   B'00000100'
   RETLW   B'00000110'
   RETLW   B'00000010'
   RETLW   B'00010010'
   RETLW   B'00010000'
   RETLW   B'00010001'


; routine to delay between steps

DELAY

   MOVLW   .10     ; 10 mSec per step
   MOVWF   DELAY1
DEL_0
   MOVLW   .250        ; 1 millisecond delay
   MOVWF   DELAY2

DEL_1

   NOP
   DECFSZ  DELAY2, F
   GOTO    DEL_1

   DECFSZ  DELAY1, F
   GOTO    DEL_0

   RETURN

   END

1999\09\21@130332 by Lea

picon face
At 02:16 PM 9/20/99 EDT, you wrote:
>Hi everyone
>
>I downloaded the following code to a 16c509 jw chip, which controls a stepper
>based on a couple of buttons, figured out the wires on my stepper (with help
>from the list), hooked everything up and the stepper displays strange
>behavior. Sometimes it will turn 1/2 rev then stop and quiver.

Hi!

You may change the routine to send the following sequence to the motor:

B'00001001'
B'00001100'
B'00000110'
B'00000011'

I use this often (dual coil powered) and it works fine but it is a full
step mode, I tried once half a step, but the motor doesn't had enough torque.

I believe that not all motors work in half step mode, specially if you need
a high torque.

I hope it was helpfull.

Ah BTW the common wires of the motor are those with the same colors (brn
usually).

Leandro.
  Leandro J. Laporta (LU2AOQ)
  mail: RemoveMElu2aoqTakeThisOuTspamyahoo.com
  wrk: Arg. Assoc. for Space Technology.
  ham: TCP/IP high speed group HSG

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...