]> hackdaworld.org Git - my-code/atmel.git/commitdiff
fixed motor ctrl via uart origin
authorhackbard <hackbard>
Sun, 18 Mar 2007 18:05:04 +0000 (18:05 +0000)
committerhackbard <hackbard>
Sun, 18 Mar 2007 18:05:04 +0000 (18:05 +0000)
hdw-tank/motor.asm

index 3339c9972e87a1cecbd93d095b2b24b1e0d02114..9e59e26af1a91e8c267997424bdfe1892a10e82f 100644 (file)
@@ -1,24 +1,24 @@
 ; motor functions
 
-.equ   MOT_DIR_L       = 0x02
-.equ   MOT_DIR_R       = 0x03
-.equ   MOT_PWR_L       = 0x04
-.equ   MOT_PWR_R       = 0x07
+.equ   MOT_1_1         = 0x04
+.equ   MOT_1_2         = 0x02
+.equ   MOT_2_1         = 0x07
+.equ   MOT_2_2         = 0x03
 
 MOTOR_INIT:
 
        ; ports -> output
        in tmp1,DDRB
-       sbr tmp1,(1<<MOT_DIR_L)|(1<<MOT_DIR_R)
-       sbr tmp1,(1<<MOT_PWR_L)|(1<<MOT_PWR_R)
+       sbr tmp1,(1<<MOT_1_1)|(1<<MOT_1_2)
+       sbr tmp1,(1<<MOT_2_1)|(1<<MOT_2_2)
        out DDRB,tmp1
 
 MOTOR_STOP:
 
        ; output zero
        in tmp1,PORTB
-       cbr tmp1,(1<<MOT_DIR_L)|(1<<MOT_DIR_R)
-       cbr tmp1,(1<<MOT_PWR_L)|(1<<MOT_PWR_R)
+       cbr tmp1,(1<<MOT_1_1)|(1<<MOT_1_2)
+       cbr tmp1,(1<<MOT_2_1)|(1<<MOT_2_2)
        out PORTB,tmp1
 
        ret
@@ -26,8 +26,8 @@ MOTOR_STOP:
 MOTOR_FWD:
 
        in tmp1,PORTB
-       sbr tmp1,(1<<MOT_DIR_L)|(1<<MOT_DIR_R)
-       sbr tmp1,(1<<MOT_PWR_L)|(1<<MOT_PWR_R)
+       sbr tmp1,(1<<MOT_1_1)|(1<<MOT_2_1)
+       cbr tmp1,(1<<MOT_1_2)|(1<<MOT_2_2)
        out PORTB,tmp1
 
        ret
@@ -35,8 +35,8 @@ MOTOR_FWD:
 MOTOR_BWD:
 
        in tmp1,PORTB
-       cbr tmp1,(1<<MOT_DIR_L)|(1<<MOT_DIR_R)
-       sbr tmp1,(1<<MOT_PWR_L)|(1<<MOT_PWR_R)
+       sbr tmp1,(1<<MOT_1_2)|(1<<MOT_2_2)
+       cbr tmp1,(1<<MOT_1_1)|(1<<MOT_2_1)
        out PORTB,tmp1
 
        ret
@@ -44,9 +44,8 @@ MOTOR_BWD:
 MOTOR_RIGHT:
 
        in tmp1,PORTB
-       sbr tmp1,(1<<MOT_DIR_L)
-       cbr tmp1,(1<<MOT_DIR_R)
-       sbr tmp1,(1<<MOT_PWR_L)|(1<<MOT_PWR_R)
+       sbr tmp1,(1<<MOT_2_2)|(1<<MOT_1_1)
+       cbr tmp1,(1<<MOT_2_1)|(1<<MOT_1_2)
        out PORTB,tmp1
 
        ret
@@ -54,9 +53,8 @@ MOTOR_RIGHT:
 MOTOR_LEFT:
 
        in tmp1,PORTB
-       sbr tmp1,(1<<MOT_DIR_R)
-       cbr tmp1,(1<<MOT_DIR_L)
-       sbr tmp1,(1<<MOT_PWR_L)|(1<<MOT_PWR_R)
+       sbr tmp1,(1<<MOT_1_2)|(1<<MOT_2_1)
+       cbr tmp1,(1<<MOT_1_1)|(1<<MOT_2_2)
        out PORTB,tmp1
 
        ret