![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
| 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 by fengshao; 28th May 2009 at 12:59 PM. | |
| |
| | #2 |
|
Have a look at this and other similar AppNotes from Microchip - they should help you understand the code. http://ww1.microchip.com/downloads/e...tes/00907a.pdf Last edited by Wp100; 28th May 2009 at 03:47 PM. | |
| |
| | #3 | |
| Quote:
Code: 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 | ||
| |
|
| Tags |
| assembly, code |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| PIC16c assembly code | Topz | Micro Controllers | 31 | 6th June 2009 09:03 AM |
| about PIC18 assembly code | fengshao | Micro Controllers | 13 | 8th May 2009 01:58 PM |
| Assembly Code Problem? | PhillDubya | Micro Controllers | 2 | 13th October 2008 02:06 PM |
| Need assembly code or other source code of a "Miniature digital pin number lock"... | chunei | Micro Controllers | 1 | 13th August 2007 06:45 PM |
| Help understanding assembly code | KMD | Micro Controllers | 9 | 16th May 2005 08:38 PM |