Code:
;************************************************************************************
; SingleStep - Single Step the motor
;
;************************************************************************************
SingleStep
movlw 8
movwf StepModeScaler
incf State,f ; Increment motor state
movlw 0xFF ; Turn off PWMs
movwf CCPR1L
movwf CCPR2L
movlw 0x30
iorwf CCP1CON,f
iorwf CCP1CON,f
SingleStateMachine ; jump to motor state based on State pointer
movlw high SingleJumpTable
movwf PCLATH
movf State,w
andlw 0x03
addlw low SingleJumpTable
btfsc STATUS,C
incf PCLATH,f
movwf PCL
SingleJumpTable
goto SingleState0
goto SingleState1
goto SingleState2
goto SingleState3
SingleState0
movlw CTRL1FWD
movwf PORTD
goto Main
SingleState1
movlw CTRL2REV
movwf PORTD
goto Main
SingleState2
movlw CTRL1REV
movwf PORTD
goto Main
SingleState3
movlw CTRL2FWD
movwf PORTD
goto Main
--------------------------------------------------
Can anyone explain to me how does it to make stepper motor step???????????????????????
thankyou very much
Last edited: