#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

#### Categories

Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

# STEPPER MOTOR PROBLEM

Posts: 1Member
hello guyz
how r u all?

i had a problem while testing stepper motor
i wrote an assembly code to rotate the stepper motor for a Specific number of steps and then it should stop but the stepper is still moving!!! can u tell what to do coz i want to stop the stpper motor after the count=0 .
am using pic16f84a and 6 wire stepper motor
[code]

;
;*******************************************************************
; NOTES:
;
;
; PORTBO= NORTH POLE
; PORTB1= EAST POLE
; PORTB2= SOUTH POLE
; PORTB3= WEST POLE
;*****************************************************************

PORTA EQU 5
PORTB EQU 6
STATUS Equ 3
TMR0 EQU 1
COUNT EQU 0CH
COUNT1 EQU 0DH
INTCON EQU 0BH
COUNTD EQU 0FH

;******************************************************************
LIST P=16F84A

org 0
goto START

;*********************************************

DELAY CLRF TMR0
MOVLW .10
MOVWF COUNT
BCF STATUS,5
WAITA BCF INTCON,2
WAITB BTFSS INTCON,2
GOTO WAITB
DECFSZ COUNT,1
GOTO WAITA
RETURN
RETLW 0
;**************************************

START

BSF STATUS,5 ;BANK1
MOVLW B'00000000'
TRIS PORTB ; b0:b3 " stepper output "
MOVLW B'00000011'
TRIS PORTA
MOVLW B'0000001'
OPTION
BCF STATUS,5 ; BANK0

CLRF PORTB
MOVLW .10
MOVWF COUNTD

LOOP1
BSF PORTB,4
CALL DELAY

MOVLW .1
MOVWF PORTB

CALL DELAY

MOVLW .2
MOVWF PORTB

CALL DELAY

MOVLW .4
MOVWF PORTB

CALL DELAY

MOVLW .8
MOVWF PORTB

BCF PORTB,4
DECFSZ COUNTD
GOTO LOOP1

BSF PORTB,5
LL NOP
GOTO LL

END
[/code]
plzz help me
· ·

• Posts: 268Member
: hello guyz
: how r u all?
:
: i had a problem while testing stepper motor
: i wrote an assembly code to rotate the stepper motor for a Specific
: number of steps and then it should stop but the stepper is still
: moving!!! can u tell what to do coz i want to stop the stpper motor
: after the count=0 .
: am using pic16f84a and 6 wire stepper motor
: [code]:
:
:
: ;
: ;*******************************************************************
: ; NOTES:
: ;
: ;
: ; PORTBO= NORTH POLE
: ; PORTB1= EAST POLE
: ; PORTB2= SOUTH POLE
: ; PORTB3= WEST POLE
: ;*****************************************************************
:
:
: PORTA EQU 5
: PORTB EQU 6
: STATUS Equ 3
: TMR0 EQU 1
: COUNT EQU 0CH
: COUNT1 EQU 0DH
: INTCON EQU 0BH
: COUNTD EQU 0FH
:
: ;******************************************************************
: LIST P=16F84A
:
: org 0
: goto START
:
: ;*********************************************
:
:
: DELAY CLRF TMR0
: MOVLW .10
: MOVWF COUNT
: BCF STATUS,5
: WAITA BCF INTCON,2
: WAITB BTFSS INTCON,2
: GOTO WAITB
: DECFSZ COUNT,1
: GOTO WAITA
: RETURN
: RETLW 0
: ;**************************************
:
: START
:
: BSF STATUS,5 ;BANK1
: MOVLW B'00000000'
: TRIS PORTB ; b0:b3 " stepper output "
: MOVLW B'00000011'
: TRIS PORTA
: MOVLW B'0000001'
: OPTION
: BCF STATUS,5 ; BANK0
:
: CLRF PORTB
: MOVLW .10
: MOVWF COUNTD
:
: LOOP1
: BSF PORTB,4
: CALL DELAY
:
: MOVLW .1
: MOVWF PORTB
:
: CALL DELAY
:
:
:
: MOVLW .2
: MOVWF PORTB
:
:
: CALL DELAY
:
:
: MOVLW .4
: MOVWF PORTB
:
: CALL DELAY
:
:
: MOVLW .8
: MOVWF PORTB
:
:
: BCF PORTB,4
: DECFSZ COUNTD
: GOTO LOOP1 [color=Red]<-- Unconditional jump to beginning of loop, instead should check if COUNTD is 0, if bigger only then jump[/color]
:
: BSF PORTB,5
: LL NOP
: GOTO LL
:
: END
: [/code]:
: plzz help me
:

· ·
• Posts: 1Member
hey there...could i use this program for pic 16F54?
i have the same thing to do but on this PIC