[En-Nut-Discussion] RE:PWM
Raul Valle
rvl180 at hotmail.com
Sun Aug 6 21:06:15 CEST 2006
Michaels thanks for the help.
The thing is i have to control around 8 to 10 servos which are for controlling
a robotic arm for a rover and to control a camera. The servos are going to be control by a software that is going to send some characters and with those i will give an order to the servos. I was reading about the Nutsleep and you are right , that why i am switching better to NutDelay and is making the delay but, i think that with a delay of 2us i should not be noticing because it should be very fast, but it seems the delay is longer because for now , testing i send from the ethernut a word , then i make the delay and then send another word and it seems the delay is longer than 2us. I am not using the pwm channel because there are so many servos that i have to come up with something else fast enough that all the servos seem to be working i guess at the same time.
any help is going to be appreciated it.Thanks
...........................................................
Message: 6
Date: Thu, 3 Aug 2006 14:15:52 -0700
From: "Raul Valle" <rvl180 at hotmail.com>
Subject: [En-Nut-Discussion] ethernut--pwm
To: <en-nut-discussion at egnite.de>
Message-ID: <BAY21-DAV4A18599B9490158CA459D9E530 at phx.gbl>
Content-Type: text/plain; charset="iso-8859-1"
hi to all:
can someone give me an idea on how to make a servo function on ethernut1.3 .
The one i did i dont know exactly why is not working . here is the code:
pos++;
sbi(PORTE,2);
for(i=0;i<pos;i++){
NutSleep(.02);
}
cbi(PORTE,2);
for(b=0;i<(1500-pos);b++){
NutSleep(.02);
------------------------------
Message: 7
Date: Thu, 3 Aug 2006 23:38:14 +0200
From: "Michael Jones" <Michael.e.Jones at web.de>
Subject: RE: [En-Nut-Discussion] ethernut--pwm
To: "'Ethernut User Chat (English)'" <en-nut-discussion at egnite.de>
Message-ID: <008501c6b745$2081ed10$de10a8c0 at LSB.lan>
Content-Type: text/plain; charset="us-ascii"
Hi,
I think you have got a few problems to solve here. The first being that
NutSleep(...) does not take a float (well not that I am aware off) so that
02 turns into 0. The second being that you can't use NutSleep(...) to
generate deterministic time slices as NutSleep(...) will pass control to
another thread and will only return when that thread (and/or others) yields
CPU time back to your thread by itself calling NutSleep(...) or similar
functions.
What exactly are you trying to implement?
Depending on the actually method you are using to control the servo there
are different solutions. Are you using an ADC? Then you might want to use an
ADC completion interrupt handler which then decides if and which direction
the motor is supposed to run.
Regards,
Michael
More information about the En-Nut-Discussion
mailing list