To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 1686
1685  |  1687
Subject: 
Re: DC output at motor max speed with legOS
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Tue, 6 Feb 2001 17:23:58 GMT
Viewed: 
1486 times
  
On Feb 6, Athan Kostakos wrote:
Hi, I am trying to control a stepper motor with LegOS, and I need to have a
constant DC output from a motor output, like when I choose speed(8) with the
Lego firmware, so I can turn it on and off to make pulses of the duration I
choose.
Is this possible?

So motor_a_speed(MAX_SPEED) is not enough, since it turns the motor
off every 256 ms for a single ms?

I have an idea how to change the code to make the output really
constant, patch attached.  A side-effect of this change is that
motor_a_speed(MIN_SPEED) is not turning the motor completely off, but
this is the purpose of motor_a_dir(off).

You have to recompile the kernel AND your programs.  Does this patch
work for you?

  Jochen

diff -u -r1.3 dmotor.h
--- include/dmotor.h 2000/08/16 09:45:10 1.3
+++ include/dmotor.h 2001/02/06 16:53:12
@@ -140,7 +140,7 @@
  */
extern const inline void motor_a_speed(unsigned char speed)
{
-  dm_a.access.c.delta = speed;
+  dm_a.access.c.delta = ~speed;
}

//! set motor B speed
@@ -148,7 +148,7 @@
  */
extern const inline void motor_b_speed(unsigned char speed)
{
-  dm_b.access.c.delta = speed;
+  dm_b.access.c.delta = ~speed;
}

//! set motor C speed
@@ -156,7 +156,7 @@
  */
extern const inline void motor_c_speed(unsigned char speed)
{
-  dm_c.access.c.delta = speed;
+  dm_c.access.c.delta = ~speed;
}

#endif // CONF_DMOTOR
===================================================================
RCS file: /cvsroot/legOS/legOS/kernel/dmotor.c,v
retrieving revision 1.2
diff -u -r1.2 dmotor.c
--- kernel/dmotor.c 2000/08/16 09:45:11 1.2
+++ kernel/dmotor.c 2001/02/06 16:53:12
@@ -89,7 +89,7 @@

                 mov.w   @_dm_a,r0
                 add.b   r0h,r0l                 ; add delta to sum
-                bcc     dm0                     ; sum overflow?
+                bcs     dm0                     ; sum overflow?
  mov.b @_dm_a+2,r6h            ; -> output drive pattern
  xor.b r6h,r6l
             dm0:mov.b   r0l,@_dm_a+1            ; save sum
@@ -99,7 +99,7 @@

                 mov.w   @_dm_b,r0
                 add.b   r0h,r0l                 ; add delta to sum
-                bcc     dm1                     ; sum overflow?
+                bcs     dm1                     ; sum overflow?
  mov.b @_dm_b+2,r6h            ; -> output drive pattern
  xor.b r6h,r6l
             dm1:mov.b   r0l,@_dm_b+1            ; save sum
@@ -109,7 +109,7 @@

                 mov.w   @_dm_c,r0
                 add.b   r0h,r0l                 ; add delta to sum
-                bcc     dm2                     ; sum overflow?
+                bcs     dm2                     ; sum overflow?
  mov.b @_dm_c+2,r6h            ; -> output drive pattern
  xor.b r6h,r6l
             dm2:mov.b   r0l,@_dm_c+1            ; save sum



1 Message in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR