Just go through the table backwards. Ie Step 4, Step 3, Step 2, Step 1, Step 4.... -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf Of Harry H. Arends Sent: Saturday, September 12, 2009 4:04 AM To: 'Microcontroller discussion list - Public.' Subject: [PIC] Steppermotor using lookuptable LS, I am using this contruction to control a unipolair steppermotor. The connections of the motor are as follows: A - RA3 B - RA2 A'- RA1 B'- RA0 The lookup table is here: [code] Full_Step: ; Used with RS 191-8299 movf STEP, w andlw 0x03 addwf PCL, f retlw b'00001001' ; Step-1 retlw b'00001100' ; Step-2 retlw b'00000110' ; Step-3 retlw b'00000011' ; Step-4 [/code] This is the stepping routine: [code] movlw .50 ; Loop 50 Time For 1.8 Degree/Step ; 4x50x1.8 = 360 movwf COUNT Go_Reverse_Full: movlw .4 movwf STEP GoReverseFull_Loop: call Full_Step ; Get the value from a table movwf PORTA call Delay ; do some delay between steps decfsz STEP, f ; count steps goto GoReverseFull_Loop decfsz COUNT, f ; Do one revolution goto Go_Reverse_Full [/code] If i wanted to go forward i could use a second lookup table but can it be done with one table and if so how? Regards Harry -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist