hm..there are several ways..

the cheapest and easiest way is just to copy the module and insert it two or
three times, with each  different major numbers..
another solution is to copy the structs and modify the servo function. for
instance, if you write:
void servo (unsigned long whichone) {
}
instead of using the argument for the status of the servo, you could use it
to handle which servo to drive high or low.

of course you can also just copy the function and call it servo2() and
servo3() , but don't forget to copy the structs..

greets,
ernst

2007/2/10, Giovanni <[EMAIL PROTECTED]>:
>
>   Here is another question:
>
> If I want to control many RC-servos independently, how can I do ?
>
> Inside the source code it is defined a single output line. So do I have to
> write many different programs, which have all the same C code, except the
> definition of the output line ? Is there a better way ?
>
> Best regards,
> Giovanni
>
> Ernst Mayerhofer <[EMAIL PROTECTED]<ernst.mayerhofer%40gmail.com>>
> wrote: yes, that's correct.
>
> 2007/2/4, Giovanni <[EMAIL PROTECTED] <pino_otto%40yahoo.com>>:
> >
> > OK, thanks.
> >
> > I will use a pin that is output only.
> >
> > If I use for example OG28, the define will be:
> >
> > #define PORT_G_SERVO_OUTPUT 1<<28
> >
> > Is it correct ?
> >
> > Best regards,
> > Giovanni
> >
> > Ernst Mayerhofer <[EMAIL PROTECTED]<ernst.mayerhofer%40gmail.com>
> <ernst.mayerhofer%40gmail.com>>
> > wrote: don't forget to set the direction of the lines 16-23 to output,
> if
> > you
> > really use the IOG17. you have either to compile it in the kernel or set
> > some register in software, but I didn't manage to do it. So just use one
> > of
> > the only OG ports.
> >
> > greets,ernst
> >
> > 2007/2/4, Giovanni <[EMAIL PROTECTED] 
> > <pino_otto%40yahoo.com><pino_otto%40yahoo.com>>:
> > >
> > > OK, thanks.
> > >
> > > I found it: #define PORT_G_SERVO_OUTPUT 1<<17
> > >
> > > So this means the line IOG17, which is the pin 10 on J7.
> > >
> > > Best regards,
> > > Giovanni
> > >
> > > Ernst Mayerhofer <[EMAIL PROTECTED]<ernst.mayerhofer%40gmail.com>
> <ernst.mayerhofer%40gmail.com>
> > <ernst.mayerhofer%40gmail.com>>
> > > wrote: okay, so, fasttimer is installed on your system. you don't have
> > to
> > > make a
> > > new kernel.
> > >
> > > the port is defined in the top of the file like
> > > #define ... 1<<25...
> > >
> > > 2007/2/4, Giovanni <[EMAIL PROTECTED] 
> > > <pino_otto%40yahoo.com><pino_otto%40yahoo.com><pino_otto%40yahoo.com>>:
> > > >
> > > > Regarding "the fox port", I mean on what pin is going to be output
> the
> > > > PWM signal generated by the servo kernel module ?
> > > >
> > > > Regarding the fast timer, here is my situation:
> > > >
> > > > [EMAIL PROTECTED] /root]3597# ls -l /proc/fasttimer
> > > > -r--r--r-- 1 root root 0 Jan 1 03:30 /proc/fasttimer
> > > > [EMAIL PROTECTED] /root]3597# tail -f /proc/fasttimer
> > > > Sanity failed: 0
> > > >
> > > > Timers started: 0
> > > >
> > > > Timers added: 0
> > > >
> > > > Timers expired: 0
> > > >
> > > > Active timers:
> > > >
> > > > Note: I don't have compiled and installed the servo kernel module
> yet.
> > > >
> > > > Is this OK for the fast timer ?
> > > >
> > > > Best regards,
> > > > Giovanni
> > > >
> > > > Ernst Mayerhofer <[EMAIL PROTECTED]<ernst.mayerhofer%40gmail.com>
> <ernst.mayerhofer%40gmail.com>
> > <ernst.mayerhofer%40gmail.com>
> > > <ernst.mayerhofer%40gmail.com>>
> > > > wrote: What do you mean "the fox port"?
> > > >
> > > > fast timer api: check on the foxboard if there is something in
> > > > /proc/fasttimer, if there is, everything is fine. otherwise you have
> > to
> > > > enable it in the kernelconfig and build a new kernel.
> > > >
> > > > 2007/2/3, Giovanni <[EMAIL PROTECTED] 
> > > > <pino_otto%40yahoo.com><pino_otto%40yahoo.com><pino_otto%40yahoo.com><pino_otto%40yahoo.com>>:
> > > > >
> > > > > OK. Thanks. I received the file.
> > > > >
> > > > > I'm a newbie, so i'm asking the following questions:
> > > > >
> > > > > What is the FOX port used by the servo kernel module ?
> > > > > How can I enable the fast timer API ?
> > > > > Thanks in advance for your help.
> > > > >
> > > > > Best regards,
> > > > > Giovanni
> > > > >
> > > > > Ernst Mayerhofer <[EMAIL PROTECTED]<ernst.mayerhofer%40gmail.com>
> <ernst.mayerhofer%40gmail.com>
> > <ernst.mayerhofer%40gmail.com>
> > > <ernst.mayerhofer%40gmail.com>
> > > > <ernst.mayerhofer%40gmail.com>>
> > > > > wrote: Hi,
> > > > >
> > > > > No i didn't forget the attachments, they were deleted.
> > > > >
> > > > > here you are: http://files.the-signs.com/servo.tar.gz
> > > > >
> > > > > 2007/2/3, Giovanni <[EMAIL PROTECTED] 
> > > > > <pino_otto%40yahoo.com><pino_otto%40yahoo.com><pino_otto%40yahoo.com><pino_otto%40yahoo.com><pino_otto%40yahoo.com>>:
>
> >
> > >
> > > >
> > > > > >
> > > > > > Dear Ernst,
> > > > > >
> > > > > > thanks for your reply. However I didn't find any file attached
> to
> > > your
> > > > > > message. Maybe forgotten ?
> > > > > >
> > > > > > Best regards,
> > > > > > Giovanni
> > > > > >
> > > > > > Ernst Mayerhofer <[EMAIL PROTECTED]<ernst.mayerhofer%40gmail.com>
> <ernst.mayerhofer%40gmail.com>
> > <ernst.mayerhofer%40gmail.com>
> > > <ernst.mayerhofer%40gmail.com>
> > > > <ernst.mayerhofer%40gmail.com>
> > > > > <ernst.mayerhofer%40gmail.com>>
> > > > > > wrote: if you want to make something which works really well,
> you
> > > have
> > > > > to do
> > > > > > it in
> > > > > >
> > > > > > the kernel ;-)
> > > > > >
> > > > > > I made a kernel module once. As I modified it now for you and
> > didn't
> > > > > test
> > > > > > it
> > > > > > on the foxboard, there might be a problem, so feel free to ask
> me
> > if
> > > > > there
> > > > > > is some problem.
> > > > > >
> > > > > > just compile the servo.c attached with the also attached
> makefile.
> > > you
> > > > > > have
> > > > > > to change the path of AXIS_TOP_DIR in the Makefile.
> > > > > >
> > > > > > once you have compiled it, transfer it to the foxboard and type:
> > > > > > $ insmod servo.o
> > > > > > if you want to see the kernel log messages, type
> > > > > > $ dmesg
> > > > > > then you can make a new device node , eg
> > > > > > $ mknod c /etc/servo c 249 0
> > > > > > and, if you want to set the servo to a specific position, write
> > the
> > > > > value
> > > > > > of
> > > > > > T_on in us to /etc/servo:
> > > > > > $ echo 500 > /etc/servo
> > > > > >
> > > > > > it should work!
> > > > > > notice that if you want to use it, you have to enable the fast
> > timer
> > > > > api.
> > > > > >
> > > > > > greets and pardon for my bad english,
> > > > > >
> > > > > > ernst mayerhofer
> > > > > >
> > > > > > 2007/2/2, Giovanni <[EMAIL PROTECTED] 
> > > > > > <pino_otto%40yahoo.com><pino_otto%40yahoo.com><pino_otto%40yahoo.com><pino_otto%40yahoo.com><pino_otto%40yahoo.com><pino_otto%40yahoo.com>>:
> > > > > > >
> > > > > > > This solution sounds cool.
> > > > > > >
> > > > > > > Did you try it with a real case ?
> > > > > > >
> > > > > > > I would like to run some real working code based on this idea.
> > If
> > > > you
> > > > > > have
> > > > > > > some code ready to run, can you post it ? Otherwise we can
> > > > collaborate
> > > > > > to
> > > > > > > develop some working code and test it.
> > > > > > >
> > > > > > > Best regards,
> > > > > > > Giovanni
> > > > > > >
> > > > > > > spargelzack <[EMAIL PROTECTED] 
> > > > > > > <spargelzack%40yahoo.com><spargelzack%
> 40yahoo.com><spargelzack%
> > 40yahoo.com><spargelzack%
> > > 40yahoo.com><spargelzack%
> > > > 40yahoo.com><spargelzack%
> > > > > 40yahoo.com><spargelzack%
> > > > >
> > > > > > 40yahoo.com>> wrote:
> > > > > > > (sorry if this shows up twice, i'm not familiar with the yahoo
> > > > groups
> > > > > > >
> > > > > > > interface yet)
> > > > > > >
> > > > > > > Hi Everybody
> > > > > > >
> > > > > > > I found a cheap + fast solution for using servos with the
> > > foxboard.
> > > > > > >
> > > > > > > First, there is a way to use the i/o lines not described on
> the
> > > > > > > acmesystems website (it's well known on the axis developer
> > website
> > > > > > > though). You can use write() on Ports A+B after proper
> > > > initialization.
> > > > > > >
> > > > > > > The Clock interval is around 5 us, so you have to pass about
> > 4000
> > > > > > > values for a full 2ms period.
> > > > > > >
> > > > > > > But as i found out, the 20ms interval isn't all that
> important.
> > > What
> > > > > > > matters is the length of the pulse.
> > > > > > >
> > > > > > > So, here's my code:
> > > > > > >
> > > > > > > --
> > > > > > > #include <stdio.h>
> > > > > > > #include "stdlib.h"
> > > > > > > #include "unistd.h"
> > > > > > > #include "sys/ioctl.h"
> > > > > > > #include "fcntl.h"
> > > > > > > #include <sys/time.h>
> > > > > > > #include <asm/etraxgpio.h>
> > > > > > >
> > > > > > > int main(int argc, char **argv){
> > > > > > > int fd;
> > > > > > > int i;
> > > > > > > int pos;
> > > > > > > unsigned char mask;
> > > > > > > unsigned char period[4000];
> > > > > > >
> > > > > > > if(argc > 1)
> > > > > > > pos = atoi(argv[1]);
> > > > > > > else
> > > > > > > pos = 100;
> > > > > > >
> > > > > > > // better use memset() here, but this is proof-of-concept code
> > > > > > > for(i=0; i<pos+1; i++){
> > > > > > > if(pos > i)
> > > > > > > period[i] = 0xFF;
> > > > > > > else
> > > > > > > period[i] = 0;
> > > > > > > }
> > > > > > >
> > > > > > > fd = open("/dev/gpiob", O_RDWR);
> > > > > > >
> > > > > > > if(!fd){
> > > > > > > printf("open error\n");
> > > > > > > exit(-1);
> > > > > > > }
> > > > > > >
> > > > > > > mask = 1<<6 | 1<<7; // use pins PB6 and PB7 according to the
> > > > > > > fox pinout
> > > > > > >
> > > > > > > // prepare for write()
> > > > > > > if(ioctl(fd, _IO(ETRAXGPIO_IOCTYPE, IO_CFG_WRITE_MODE),
> > > > > > > IO_CFG_WRITE_MODE_VALUE(1, mask, 1<<1))){
> > > > > > > perror("ioctl error");
> > > > > > > exit(-1);
> > > > > > > }
> > > > > > >
> > > > > > > for(;;){
> > > > > > > write(fd, &period, pos+1); // write the pulse,
> > > > > > > followed by a zero to set the output
> > > > > > > usleep(5000); // let the CPU breathe a bit..
> > > > > > > }
> > > > > > > }
> > > > > > > --
> > > > > > >
> > > > > > > This only works with ports A and B, not with the G line.
> > > > > > >
> > > > > > > Supply any value between 100 and 400 as first argument to set
> > the
> > > > > > > position of two servos connected to PB6 and PB7.
> > > > > > >
> > > > > > > example:
> > > > > > >
> > > > > > > ./motor 180
> > > > > > >
> > > > > > > This uses LESS THAN 1% CPU when running.
> > > > > > >
> > > > > > > This is proof of concept code, so it's UGLY AND NOT USEFUL OUT
> > OF
> > > > THE
> > > > > > > BOX. Also, my english sucks a bit.
> > > > > > >
> > > > > > > --- In [email protected] 
> > > > > > > <foxboard%40yahoogroups.com><foxboard%40yahoogr
> oups.com><foxboard%40yahoogr
> > oups.com><foxboard%40yahoogr
> > > oups.com><foxboard%40yahoogr
> > > > oups.com><foxboard%40yahoogr
> > > > > oups.com><foxboard%40yahoogr
> > > > > > oups.com>, "zooltheno1"
> > > > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > > >
> > > > > > > > Hi
> > > > > > > > I want to use RC-Servos with the Foxboard, the normal
> > interfall
> > > is
> > > > > > > > 1-2ms and 20ms pause.
> > > > > > > > I tried to use udelay for the delay, put the minimum is
> 40ms,
> > > > > > > > which is far to slow, even normal AC is faster.
> > > > > > > > How could I get the nesasery delay without 100% CPU load ?
> > > > > > > >
> > > > > > > > Bye
> > > > > > > > Ralph
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > ------------------------------------------------
> > > > > > > Resources are limited, Imagination is unlimited.
> > > > > > >
> > > > > > > ---------------------------------
> > > > > > > Want to start your own business? Learn how on Yahoo! Small
> > > Business.
> > > > > > >
> > > > > > > [Non-text portions of this message have been removed]
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > > [Non-text portions of this message have been removed]
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > ------------------------------------------------
> > > > > > Resources are limited, Imagination is unlimited.
> > > > > >
> > > > > > ---------------------------------
> > > > > > Everyone is raving about the all-new Yahoo! Mail beta.
> > > > > >
> > > > > > [Non-text portions of this message have been removed]
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > > [Non-text portions of this message have been removed]
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > ------------------------------------------------
> > > > > Resources are limited, Imagination is unlimited.
> > > > >
> > > > > ---------------------------------
> > > > > Don't pick lemons.
> > > > > See all the new 2007 cars at Yahoo! Autos.
> > > > >
> > > > > [Non-text portions of this message have been removed]
> > > > >
> > > > >
> > > > >
> > > >
> > > > [Non-text portions of this message have been removed]
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > ------------------------------------------------
> > > > Resources are limited, Imagination is unlimited.
> > > >
> > > > ---------------------------------
> > > > Expecting? Get great news right away with email Auto-Check.
> > > > Try the Yahoo! Mail Beta.
> > > >
> > > > [Non-text portions of this message have been removed]
> > > >
> > > >
> > > >
> > >
> > > [Non-text portions of this message have been removed]
> > >
> > >
> > >
> > >
> > >
> > > ------------------------------------------------
> > > Resources are limited, Imagination is unlimited.
> > >
> > > ---------------------------------
> > > Don't get soaked. Take a quick peak at the forecast
> > > with theYahoo! Search weather shortcut.
> > >
> > > [Non-text portions of this message have been removed]
> > >
> > >
> > >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> >
> >
> > ------------------------------------------------
> > Resources are limited, Imagination is unlimited.
> >
> > ---------------------------------
> > Bored stiff? Loosen up...
> > Download and play hundreds of games for free on Yahoo! Games.
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
> ------------------------------------------------
> Resources are limited, Imagination is unlimited.
>
> ---------------------------------
> Any questions? Get answers on any topic at Yahoo! Answers. Try it now.
>
> [Non-text portions of this message have been removed]
>
>  
>


[Non-text portions of this message have been removed]

Reply via email to