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 / 1814
1813  |  1815
Subject: 
Re: Assembly in my C-program
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Wed, 28 Mar 2001 23:21:33 GMT
Viewed: 
1524 times
  
Athanasios Kostakos <athan@icu.strath.ac.uk> writes:

Actually I am trying to control a stepper motor. So when i need to send 50 pulses
fast, motor on and off takes same time because there same other tasks running at
the same time.
So it would be much quicker if I could just call motor speed (50), and Legos would

perform the on off for me (as it does now, but not continuously -pwm).

Jakob Engblom wrote:

In lugnet.robotics.rcx.legos, Athanasios Kostakos writes:
HI,

I was wondering if I could write assembly code in my c-program. I would like • to
access the motor output port as a digital port and control when it is on and
when off (possibly writting something like "mov.b r6l,@0xf000:16").

This should be performed by mapping a variable on top of the memory location,
and NOT by inline assembly.

Or can I change the dmotor.h file and when I call the "motor_a_speed(1-255)",
actually to control the times the motor output port will go on and off?

If you want to drive directly the motors you should first disable motor
handling in legOS (remove CONF_DMOTOR definition in config.h).  Then you
can create a high priority task that switches motors on and off writing in
the motor output port.  Use wait_event() to get accurate timing if you want
to allow low priority task to run.

The same effect of a "mov.b r6l,@0xf000:16" can be achieved by using the C
statement "*(volatile char *)0xf000 = v;", where `v' is the value you
want to write into the port.  If you really have to inline assembly
instruction you can use an `asm' statement.

An alternative way to drive stepping motors is hacking the kernel.  The
file to start with is dmotor.c; there you can find the functions that
control motor outputs.  Maybe it will be a little harder, but you'll have
more fun :-).

bye
Bernardo



Message is in Reply To:
  Re: Assembly in my C-program
 
Actually I am trying to control a stepper motor. So when i need to send 50 pulses fast, motor on and off takes same time because there same other tasks running at the same time. So it would be much quicker if I could just call motor speed (50), and (...) (23 years ago, 28-Mar-01, to lugnet.robotics.rcx.legos)

5 Messages 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